February 25, 2010 at 7:53 am
Hi All,
I have a requirement that i need to concate rows based on the id. with out using cursors
Can any one help me in this??
In Advance Thanks!!
Regards
Siva
February 25, 2010 at 7:58 am
What do you mean, concatenate rows? Specific counts, or a however many meet some criteria?
Showing some sample data and DDL would help.
February 25, 2010 at 7:59 am
As a hint, a cross tab or PIVOT might be what you need.
February 25, 2010 at 11:46 am
February 26, 2010 at 1:09 am
Achiever-785539 (2/25/2010)
Hi All,I have a requirement that i need to concate rows based on the id. with out using cursors
Can any one help me in this??
In Advance Thanks!!
Regards
Siva
Some people mean "concatenate" and some people mean "pivot". A before and after example of what you'd like to do would be really helpful in helping you.
--Jeff Moden
Change is inevitable... Change for the better is not.
March 5, 2010 at 9:12 am
SELECT p1.CategoryId,
( SELECT ProductName + ','
FROM Northwind.dbo.Products p2
WHERE p2.CategoryId = p1.CategoryId
ORDER BY ProductName
FOR XML PATH('') ) AS Products
FROM Northwind.dbo.Products p1
GROUP BY CategoryId ;
i prefer using For XML in this scenario for more inf.
March 18, 2010 at 3:47 am
Sorry for my late reply.
Thanks for all ur suggestions.
I have done it by using xml path in query.
March 18, 2010 at 4:07 am
handkot (2/25/2010)
see this topicmaybe Paul White post help you
:w00t:
Paul White
SQLPerformance.com
SQLkiwi blog
@SQL_Kiwi
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply