February 25, 2013 at 4:28 pm
Hello
I have attached images with the sample data.
Basically I want to break notes column based on the ItemName coulmn. Notes column has combined ItemNAme column based on ItemId and displayindex.
display index is the order in which the itemname are arranged in notes.
Thanks for your help.
February 25, 2013 at 6:05 pm
shah.p.vishal (2/25/2013)
HelloI have attached images with the sample data.
Basically I want to break notes column based on the ItemName coulmn. Notes column has combined ItemNAme column based on ItemId and displayindex.
display index is the order in which the itemname are arranged in notes.
Thanks for your help.
Please the link in my signature about splitting strings. It will explain a very solid way to approach this.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
February 25, 2013 at 11:43 pm
You need the function Sean mentioned, then use a CROSS APPLY:
SELECT
N.ItemID
,N.ItemName
,N.Notes
,N.DisplayIndex
,dsk.Item AS Result
FROM
YourTable AS N
CROSS APPLY
DelimitedSplit8K(N.Notes,',') AS dsk
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply