查询一个表中的记录
要求某一个或者某几个字段的值不能为空而且不能为0请大家帮忙,尤其是如何在SQL语句里判定字段是否为空
(我也不知道是不是可以做到)

解决方案 »

  1.   

    SQL Server 中 利用IsNull(字段,0)<>0
      

  2.   

    最好设计表时就设定默认值
    数值型的默认为0
    字符型默认为空字符串
    日期型默认为1900年
    这样你以后编程查询就不用为null烦心了
      

  3.   

    特别是
    查询不为空时只要使用条件 : xx<>0,xx<>'',xx>'1900'
      

  4.   

    select * from tablename
    where fld1 is not null and fld1<>0 and fld2 is not null and fld2<>0 ...