大部分网友都是建议一个一个写,多么痛的领悟......
方法如下:
declare @s nvarchar(1000)
select @s=isnull(@s+',','')+quotename(Name) from syscolumns
where ID=object_id('表名')
and Name not in('排除字段')
order by colid
exec('select '+@s+' from 表名')
大部分网友都是建议一个一个写,多么痛的领悟......
方法如下:
declare @s nvarchar(1000)
select @s=isnull(@s+',','')+quotename(Name) from syscolumns
where ID=object_id('表名')
and Name not in('排除字段')
order by colid
exec('select '+@s+' from 表名')