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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 String Split Question

Author  Topic 

tonydang2002
Starting Member

15 Posts

Posted - 2014-03-06 : 16:57:22
Hi,
I have data string as below:
1001|Tony|92841|,|1002|Dennis|92683|,1003|David|92541

I'm looking for SQL script or SP that I can run to split into multiple rows and insert this into a SQL table.

something like:
EXEC stringsplit '1001|Tony|92841|,|1002|Dennis|92683|,1003|David|92541'

and my end result would be:
My table:
ID Name Zipcode
1001 Tony 92841
1002 Dennis 92683
1003 David 92541

Thank you for your help!
Tony

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-03-06 : 17:11:59
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -