View Single Post
  #6 (permalink)  
Old 10-05-2006, 12:57 AM
john
 
Posts: n/a
Default T-SQL answer. Re: Return a comma seperated string?

[sql]use pubs
go
DECLARE @str NVARCHAR(4000)
-- Forming the comma separated string
SELECT @str= COALESCE(@str+',' , '') + (A.stor_name)
FROM (SELECT distinct stor_name = RTRIM(stor_name) FROM stores ) A
-- now show the string
Select @str[/sql]
Reply With Quote