Wednesday, April 10, 2013

How to concatenate or join multiple rows into single row in sql server using STUFF and XML Path

SELECT ColorCommaDelimitedList =
Stuff((SELECT ', ' + Color AS [text()]
        FROM  
        (SELECT DISTINCT Color FROM AdventureWorks2008.Production.Product
         ) x
        For XML PATH ('')),1,1,'')



 

6 comments:

Anonymous said...

This excellent website certainly has all of the information and facts I wanted about this subject and didn't know who to ask.


Feel free to surf to my web page ... Las Vegas Appliance Service

Anonymous said...

MFC AA_Angela Recorded Private Show 30.05.2014
Download: http://bit.ly/1oB43AT

Tags:
AA_Angela MFC dildo show 30.05.2014,
AA_Angela MyFreeCams private show 30.05.2014,
MFC AA_Angela true private 30.05.2014,
AA_Angela webcam private show

Anonymous said...

Nіce post. I learn something totally new
and challenging on ѡebsites I stumbleupߋn everyday. It ԝiol always be interеsting tо
reaԀ through articles from other writers and use a littlе something from other websites.


Here is my page; info bisnis

Anonymous said...
This comment has been removed by a blog administrator.
Anonymous said...

The number of games. The game explains a story, and others have developed a criminal case cheats passion to play?

Well if it's Android you're playing the games directly on their smart phones,
low barriers to entry, everyone finds gaming applications.
The device also facilitates deep market understanding on industry segments and various types of weather, be
ready to go to play intriguing games on the go and SIM free deal.

And criminal case cheats so, it's only available in the palm
of your choice.

my weblog :: Criminal case cheat download free

Anonymous said...
This comment has been removed by a blog administrator.