表: TABLE1
            字段1  字段2  字段3   字段4
有一条记录: aa       10    20     <null>
sql语句怎样写?
 select * from table1 where 字段4=''?

解决方案 »

  1.   

    select * from table1 where 字段4 is null
      

  2.   

    SELECT * FROM TABLE1 WHERE 字段4 IS NULL
      

  3.   


    select *,tmp=isnull(字段4,'') from table1 where tmp=''  --仅是用法,空值直接用1楼
      

  4.   

    select * from table1 where ISNULL(字段4, '') = ''
      

  5.   


    select * from table1 where 字段4 is null
      

  6.   

    SELECT * 
    FROM  table1 
    WHERE 字段4 is null
      

  7.   

    select * from table1 where 字段4 is null
      

  8.   


    select * from table1 where 字段4 is null
      

  9.   

    三、SET ANSI_NULLS当 SET ANSI_NULLS 为 ON 时,所有对空值的比较均取值为 UNKNOWN。当 SET ANSI_NULLS 为 OFF 时,如果数据值为 NULL,则所有数据对空值的比较将取值为 TRUE。如果未指定,则应用当前数据库的 ANSI nulls 选项的设置。另外,当该选项为真是,必须使用is null条件来判断一个列是否包含null值;当这个选项为假时,sql server中=null等价于is null,<>null 等价于is not null。
      

  10.   

    select * from table1 where 字段4 is null
      

  11.   

    select * from table1 where 字段4 is null
      

  12.   


    select * from tb where 字段4 is null
      

  13.   

    select * from table1 where 字段4 is null楼上回答的是正确的。