SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Split column by semi colon
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sheel331
Starting Member

1 Posts

Posted - 09/18/2012 :  12:06:08  Show Profile  Reply with Quote
Hello,

I have a SQL query that puts my data into the following format (sorry for the format, 5588 is ID, the semicolon delimited items are AUTH_ID, 2010 Boot camp is PUB_Name, 11 is PUBL_MO, 2010 is PUBL_YR, Impact... is title, and Darrell,John,Donna are Author_NAME):

id AUTH_ID PUB_NAME PUBL_MO PUBL_YR TITLE AUTHOR_NAME
5588 ;39830;39050;27472 2010 Boot Camp 11 2010 Impact of International Changes Darrell,John,Donna

I want to split out the AUTH_ID into individual rows, with one ID number in each row, but all of the other information can be the same. The number of items in the AUTH_ID column could be 1 number, or it could be several (4-5). Unfortunately I'm not familiar with how to do this, so any help would be appreciated.

Thanks in advance,
Sheel

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 09/18/2012 :  12:51:23  Show Profile  Reply with Quote
see scenario 4

http://visakhm.blogspot.com/2010/01/multipurpose-apply-operator.html

the udf used can be found here

http://visakhm.blogspot.com/2010/02/parsing-delimited-string.html

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

wierdy
Starting Member

1 Posts

Posted - 10/10/2012 :  08:02:04  Show Profile  Reply with Quote
I was searching for something similar to this and found a solution that worked for me here:
http://www.syntaxwarriors.com/2012/t-sql-splitting-strings-into-multiple-rows/
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000