Brzo kreiranje liste kolona neke tabele
declare @s varchar(max)
set @s = ''
select @s = @s + ',' + g.name
from syscolumns g
inner join sysobjects o on g.id = o.id and o.name = 'tHE_Move'
where g.iscomputed = 0 and Objectproperty(g.id,'IsUserTable')=1 and g.name <> 'anQid'
order by g.colorder
select right(@s, len(@s) -1)
--------------------------------
declare @s varchar(max)set @s = ''
select @s = @s + ',' + namefrom syscolumnswhere id in (select id from sysobjects where name = 'tPA_SetDocType') and name <> 'anQid'order by colorder
print @s
--------------------------declare @s varchar(max), @t varchar(max), @tbl char (20)set @s = ''set @t = ''set @tbl = 'tPA_SetDocType'select @s = @s + ',' + name, @t = @t + ',g.' + namefrom syscolumnswhere id in (select id from sysobjects where name = @tbl) and name <> 'anQid'order by colorderprint @sprint @t