通过设置set ansi_null开关,=NULL有不同的结果。
一般不使用=null来判断,建议用is (not) null来判断。''表示一个空串,是一个字符型的值。null表示没有值。

解决方案 »

  1.   

    还有就是rtrim(warehouse)<>''和 rtrim(warehouse) is not null有什么区别?
    晕了~~?~~~~~~~~~~~~~~~~~
      

  2.   

    rtrim(col1)=''                       rtrim(col1)空字符串为TRUE,null时为false
    rtrim(col1)=NULL                     永远false
    rtrim(col1) is null                  rtrim(col1)为null时为TRUE,空字符串时为false
      

  3.   

    rtrim(col1)='' :字段值为空字符串
    rtrim(col1)=NULL : 字段未赋值, 未知值NULL
    rtrim(col1) is null : 能返回一个判断值,True或  False值 
      

  4.   

    create table tb(id int,c varchar(10))
    insert tb select 1,'' union all select 8,nullselect * from tb where c=''
    /*
    id          c
    ----------- -----------
    1           
    */
    select * from tb where c is null
    /*
    id          c
    ----------- -----------
    8           NULL     
    */
    set ansi_nulls on
    select * from tb where c=null
    /*
    id          c
    ----------- ----------- 
    */
    set ansi_nulls off
    select * from tb where c=null
    /*
    id          c
    ----------- ----------- 
    8           NULL
    */
    drop table tb
      

  5.   

    =NULL 一般都用于给变量赋null 值用。。
    IS NULL
    IS NOT NULL判断用的
      

  6.   

    select * from tb where c<>''
    /*
    id          c
    ----------- -----------       
    */
    select * from tb where c is not null
    /*
    id          c
    ----------- -----------
    1     
    */
      

  7.   

    如果一个字段是由空格组成的,rtrim()之后就应该得到空字符串而不是null?
      

  8.   


    rtrim(null值)=''  true?false