Thursday, May 14, 2009

Creating Comm Separated string Using Select Statement.

We can Create comma separated string in Sql using simple select statement.

here is the sql script for this task.

declare @AllUsers varchar(500)
set @AllUsers=''
Select @AllUsers=@AllUsers+cast([ID] as varchar(20))+',' from User_mst
print substring(@AllUsers,0,len(@AllUsers))


No comments:

Post a Comment

Comments posted on ASP.Net Ajax Tutorials Blog are moderated and will be approved only if they are on-topic and not abusive. Please email me or my team for tech-support or blogging related questions. Avoid including website URLs in your comments - Thanks Author