Showing posts with label SQL2005. Show all posts
Showing posts with label SQL2005. Show all posts

Thursday, August 21, 2008

Fetching Values Of Sql Table as Comma Seprated Values In SQL Variable

Declare @Str varchar(2000)

Begin

(Select @Str=COALESCE(@Str, '','') + Cast([Employee_name] as nvarchar(100)) + ','

from dbo.Employee )

Select substring(@Str,0,len(@str))

End