select * from table where columnname is null

解决方案 »

  1.   

    select isnull(columnname,默认值) from table where .....
      

  2.   

    同意一楼的yelook(雨枫),但是仅限于SQL Server
      

  3.   

    不止,我至少知道ORACLE也是如此.sybase我不太清楚
      

  4.   

    IF SET ANSI_NULLS OFF
    YOU CAN USE 
       SELECT * FROM t1 WHERE a IS NULL
    SET ANSI_NULLS ON
    YOU CAN USE 
       SELECT * FROM t1 WHERE a = NULL
      

  5.   

    为空和为NULL是完全不同的两种概念,
    为空指字符长度为0的字段值 用 if field <> ''判断
    为NULL指该字段值为未知 用 isnull(field,exp)或其他条件语句来判断
      

  6.   

    if @a is nullor@b is not null