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.
| Author |
Topic |
|
techytechy
Starting Member
1 Post |
Posted - 2010-01-12 : 09:47:02
|
| Hi guys, I am using sql server 2005Need a function to split concatenated and delimited string into seperate columnsInput to the function is one string like:Fn('code1-Region1, code1-Region2, code2-region1')in the above Concatenation is '-' and delimiter is ','Need output into two tables like:OutputTable1--------------------codecol -----------code1 code2 ........---------------------OutputTable2----------------------Regioncol-----------Region1Region2........-----------------------Thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-01-12 : 09:48:31
|
| Search for Split function in this forumMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-01-12 : 10:24:35
|
| [code]INSERT INTO OutputTable1SELECT PARSENAME(REPLACE(f.Val,'-','.'),2)FROM dbo.ParseValues(@YourString,',') fORDER BY f.IDINSERT INTO OutputTable2SELECT PARSENAME(REPLACE(f.Val,'-','.'),1)FROM dbo.ParseValues(@YourString,',') fORDER BY f.IDParsevalues can be found herehttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=115544[/code] |
 |
|
|
|
|
|
|
|