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 string

Author  Topic 

slimt_slimt
Aged Yak Warrior

746 Posts

Posted - 2009-11-27 : 07:29:56
how can i split this string into each numbers in separate row?


declare @temp table (string varchar(50))
insert into @temp select '2;5;15;212'
union all select '2;5'


desired results:

2
5
15
212

or

2
5


thank you

robvolk
Most Valuable Yak

15732 Posts

Posted - 2009-11-27 : 07:36:51
Here's one method:

http://www.sqlteam.com/article/parsing-csv-values-into-multiple-rows
Go to Top of Page
   

- Advertisement -