Concatenation of integers with commas in SQL Server? -


i find execute following query:

select * table id in (1,2,3,4) 

is there function can concatenate resultset returns integers commas?

for example

concatenate(select id table) return 1,2,3,4

this trick... think more efficient in application layer there times (reporting) when end resorting these types of tricks.

declare @liststr varchar(max) select @liststr = coalesce(@liststr+',' ,'') + cast(id varchar(10)) table select @liststr 

i learned trick pinal dave see: create comma delimited list using select clause table column


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

ruby - Nesting modules inside of a Rails eninge gem -

Eclipse formatter for java ending braces -