Get a column value in a single coma separated string in SQL

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