May 7, 2010 at 7:30 am
I have a row with two columns. One column has primary key and other one has country codes seprated by comma like US,CA,IN etc. I need to split this into multiple rows like 1, US as first row, 1, CA as second row and 1, IN as third row. Any help is appreciate.
Surendra
May 7, 2010 at 8:35 am
My problem is solved by writing a split function and then used cursor to get the data. Thank you guys.
Suri
May 7, 2010 at 8:42 am
You really don't need to use cursors. A delimited split function written as an inline TVF used with cross apply would work much more efficiently.
You can find several such functions here on SSC, and here is a link to a post where I have one uploaded: http://www.sqlservercentral.com/Forums/FindPost745780.aspx.
May 7, 2010 at 8:58 am
Thank you for sharing the link.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply