declare @table varchar(100)
declare @a varchar(2000)
set @table='AF_AllCaseInfo'--表名
select @a=ISNULL(@a,'')+','+name from sys.columns
where object_id=(select object_id from sys.tables where name=@table)
and name not in('ID')--括号里写你不要的列
set @a=stuff(@a,1,1,'')
exec(' select '+@a+' from '+@table)
declare @a varchar(2000)
set @table='AF_AllCaseInfo'--表名
select @a=ISNULL(@a,'')+','+name from sys.columns
where object_id=(select object_id from sys.tables where name=@table)
and name not in('ID')--括号里写你不要的列
set @a=stuff(@a,1,1,'')
exec(' select '+@a+' from '+@table)