Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Split column by semi colon

Author  Topic 

sheel331
Starting Member

1 Post

Posted - 2012-09-18 : 12:06:08
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

52326 Posts

Posted - 2012-09-18 : 12:51:23
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 Post

Posted - 2012-10-10 : 08:02:04
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
   

- Advertisement -