declare @sql varchar(4000)
set @sql=''select @sql=@sql+',['+name+']'
from syscolumns
where id=object_id('表名') and name not in('a')--这里可以写In('a','b','c'..)多个不要显示的列名
order by colidset @sql='select '+substring(@sql,2,len(@sql))+' from 表名'
print @sql
exec(@sql)
set @sql=''select @sql=@sql+',['+name+']'
from syscolumns
where id=object_id('表名') and name not in('a')--这里可以写In('a','b','c'..)多个不要显示的列名
order by colidset @sql='select '+substring(@sql,2,len(@sql))+' from 表名'
print @sql
exec(@sql)
declare @sql varchar(4000)
set @sql=''select @sql=@sql+',['+name+']' from syscolumns
where id=object_id('table') and name <>'a' order by colidset @sql='select '+substring(@sql,2,len(@sql))+' from table'
print @sql
exec(@sql)