Get Column values in a single coma separated string in SQL Server


We can get all values of a column in a single coma separated string this query. 

Declare @id  varchar(Max)
Select @id = coalesce(@id + ',' ,'') + Cast(ItCode as varchar(10)) From ItMast
Select @id 

After you will get result like this


ComaImg.png


Reference From : http://www.c-sharpcorner.com/Blogs/9637/get-a-column-value-in-a-single-coma-separated-string-in-sql.aspx









Comments

Popular posts from this blog

Draw Line and Text on Bitmap Image in C#