select A1,A4,A5……An from 表 这种方法是最快的解决方法了,当然可能不是最好的
http://expert.csdn.net/Expert/topic/2270/2270480.xml?temp=.9384424 /**** 多列中的某一列不查 declare @ varchar(8000) set @='' select @=@+rtrim(name)+',' from syscolumns where id=object_id('你的表名') and name not in ('你不要的列名1','你不要的列名1') set @=left(@,len(@)-1)exec('select '+@+' from 你的表名')
declare @ varchar(8000) set @='' select @=@+rtrim(name)+',' from syscolumns where id=object_id('你的表名') and name not in ('你不要的列名1','你不要的列名2') set @=left(@,len(@)-1)exec('select '+@+' from 你的表名')
这种方法是最快的解决方法了,当然可能不是最好的
/**** 多列中的某一列不查
declare @ varchar(8000)
set @=''
select @=@+rtrim(name)+',' from syscolumns where id=object_id('你的表名') and name not in ('你不要的列名1','你不要的列名1')
set @=left(@,len(@)-1)exec('select '+@+' from 你的表名')
set @=''
select @=@+rtrim(name)+',' from syscolumns where id=object_id('你的表名') and name not in ('你不要的列名1','你不要的列名2')
set @=left(@,len(@)-1)exec('select '+@+' from 你的表名')