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