Hello friends here i am going to show you how to display the records in a coma separated string from a table..
for example say you have a records like following:
NAME
Ravi
Mahesh
Mohan
Rajesh
and you want to display it as follow..
Ravi,Mahesh,Mohan,Rajesh ....than follow this syntax of query.
DECLARE @listStr VARCHAR(MAX)
SELECT @listStr = COALESCE(@listStr+',','') +
Name from Employee
SELECT @listStr as Names
hope you enjoyed it..!
hope you enjoyed it..!
0 comments:
Post a Comment