在sql查询中
通常选取字段都是select 字段1,字段2,字段3....... from 表,
如果有很多字段,就不想要其中一个
有没有方法能 select 非(字段1) from 表 查到其他字段的内容呢
把字段1去掉
通常选取字段都是select 字段1,字段2,字段3....... from 表,
如果有很多字段,就不想要其中一个
有没有方法能 select 非(字段1) from 表 查到其他字段的内容呢
把字段1去掉
declare @s nvarchar(1000) set @s='' select @s=@s+','+quotename(Name) from syscolumns where ID=object_id('表') and Name not in('不要的列名') select @s=stuff(@s,1,1,'') print @s exec('select '+@s+' from 表')