将列名输出为一行,用逗号分隔

–将列名输出为一行,用逗号分隔
select STUFF(
(select ‘,’+a.name
from syscolumns A Inner Join sysobjects D on A.id=D.id
and d.name=’formtable_main_308’ order by a.colorder for xml path(”))
,1,1,”)

Leave a Comment