Concatentate using group by


Please login or register to vote for this query.

(click on this box to dismiss)

Mythology Meta

Q&A about the site for enthusiasts and scholars of mythology and folklore

-- Change the value of UserId below
-- to avoid fetching a cached result set

DECLARE @UserId int = ##UserId##

select C1.object_id,
       stuff((select ','
              from sys.all_columns as C2
              where C1.object_id = C2.object_id
              for xml path(''),  type).value('.', 'nvarchar(max)'), 1, 1, '')
from sys.all_columns as C1
group by C1.object_id

Enter Parameters

Switch to main site
loading Hold tight while we fetch your results