March 28, 2013 at 4:17 am
I have a table that contain a row
table name = PMInfo
pmid,member
1, jay-raj-kit
i want output like that
1 , jay
1 , raj
1, kit
Regards
Arjun.
March 28, 2013 at 4:27 am
You can use the DelimitedSplit8K function for your requirement
SELECTPMI.pmid, DS.Item
FROMPMInfo AS PMI
CROSS APPLY dbo.DelimitedSplit8K( PMI.member, '-') AS DS
The code for the function is present in the article by Jeff Moden below
http://www.sqlservercentral.com/articles/Tally+Table/72993/
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 28, 2013 at 4:53 am
Hello Kingston Dhasian,
I have tried this query but it has show error "Invalid column name DS.ITEM".
I have converted this query as my table structure.
Regards,
Arjun
March 28, 2013 at 5:36 am
writearjun53 (3/28/2013)
Hello Kingston Dhasian,I have tried this query but it has show error "Invalid column name DS.ITEM".
I have converted this query as my table structure.
Regards,
Arjun
You will need to a) read the article b) create the function.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 28, 2013 at 6:51 am
Yes I have read article and found the solution
Thanks all.
Regards,
Arjun
March 28, 2013 at 8:05 am
writearjun53 (3/28/2013)
Yes I have read article and found the solutionThanks all.
Regards,
Arjun
Chris forgot about step c) Understand the code. This is important because it is you that has to support it.
_______________________________________________________________
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/
March 28, 2013 at 8:26 am
writearjun53 (3/28/2013)
Yes I have read article and found the solutionThanks all.
Regards,
Arjun
You say you found the solution, forum etiquette would have you share your solution for others.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply