How can get multiple coumn value in single column with camman separeted using sql. like
I have table test2 and column name id and value like this
Id
1
2
3
4
5
6
..
and I want result like this 1,2,3,4,5,6,....
solution:
declare @a varchar(500)
set @a = ' '
select @a = @a + cast(id as varchar(20)) + ',' from test2
if len(@a)>1
set @a= left(@a,len(@a)-1)
select case @a when ' ' then '0' else @a end as id
Sunday, January 11, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment