Select * from 物料表 where 字段1 is not null and 字段2 is not null ...

解决方案 »

  1.   

    select * from 物料表 where 字段1 is not null and 字段2 is not null ...and 字段n is not null
      

  2.   

    如果不愿意手工写字段名,可以用生成SQL语句的方法:delcare @sql varchar(8000)
    set @sql='select * from 物料表 where '
    select @sql=@sql+'['+name+'] is not null and ' from syscolumns where object_id('物料表')=id
    set @sql=left(@sql,len(@sql)-5)
    exec(@sql)
      

  3.   

    谢谢大家
    不过sorry
    是我表达错误了,我是想把非空的列取出来
      

  4.   

    某列有空记录就不选?
    select col1 from table where not exists (select col1 from table where col1 is null)
      

  5.   

    Select * from 表 where 字段1 is not null或:Select * from 表 where isnull(字段1,'')<>''
      

  6.   

    Select * from 表 where 字段1 is not null或:Select * from 表 where isnull(字段1,'')<>''
    或者
    Select * from 表 where 字段1 not in(Select 字段1 from 表 where 字段1='')