Monday, March 12, 2012

how to list the records of a select

Hi world,
Normally we receive the results of a query in several or thousands of rows.
Select * From Clients
--------
Row1. Client1
Row2. Client2
...
Which is the the way to have everything on the same row separated by commas?
Row1. Client1, Client2...

thx
David

DECLARE @.MyStr varchar(8000)

SELECT @.MyStr = ISNULL(@.MyStr, '') + Column1+ ',' + Column2+ ','
FROM Anal
where UserName is not null
print @.MyStr
Thanks,
Ram

No comments:

Post a Comment