Concatenate column values as single value SQL Server 2005 -


i have table column:

|-------------| | columnname  | |-------------| | value 1   | | value 2   | | value 3 | | value 4  | | value 5  | |-------------| 

i declare variable,

declare @columnnamelist varchar(max) 

and should find below value in variable

'value one,value two,value three,value four,value five' 

can me out in doing this?

thanks in advance.

select @columnnamelist = stuff  (     select ',' + columnname       tablename     order columnname       xml path('root') ), 1, 1, '' 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -