Return the all column values of table in comma separated in SQLServer
Declare @Var Varchar(8000)
Select @Var = COALESCE(@Var+',' , ' ') + qty FROM mytab
SELECT @Var
result is:- a,b,c,d,e,f
Select @Var = COALESCE(@Var+',' , ' ') + qty FROM mytab
SELECT @Var
result is:- a,b,c,d,e,f
Comments
Post a Comment