January 12, 2010 at 7:55 am
Hi guys,
I am using sql server 2005
Need a function to split concatenated and delimited string into seperate columns
Input 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
-----------
Region1
Region2
....
....
-----------------------
Thanks
January 12, 2010 at 8:20 am
I'd recommend a two-step approach...
1. split the string into the comma-separated portion into a column in a temp table
2. split the column with the dash-separated columns
You might want to take a look at this thread. It is doing a lot of what you're looking for.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply