我的数据类型为Float[code] select  case  when AA='' then 'AAA' 
when AA is null then 'BBB'
end ,
AA from TABLEA [/code]
为什么我的AA为0 时显示AAA??
难道Float的空 默认为 0???

解决方案 »

  1.   

    AA为0 时显示AAA?? 什么意思?
      

  2.   

    select  case  when AA='' then 'AAA' 
    when AA is null then 'BBB'
    end ,
    AA from TABLEA 
      

  3.   

    IF OBJECT_ID('TEMPDB..#')IS NOT NULL DROP TABLE #
    GO
    CREATE TABLE #(AA FLOAT)
    INSERT # SELECT ''
    INSERT # SELECT 0
    INSERT # SELECT 12.2
    select  case  when AA='' then 'AAA' 
    when AA is null then 'BBB' 
    end , AA from # 
    /*     AA                                                    
    ---- ----------------------------------------------------- 
    AAA  0.0
    AAA  0.0
    NULL 12.199999999999999(影響 3 個資料列)*/
      

  4.   

    问题叙述不清楚.
    如果用float觉得不好,用decimal.
      

  5.   

    为什么 float 的空和0一样???
      

  6.   

    为空 和 为 null  不一样!!!!
      

  7.   

    如果一樣,還分''與null 干嗎~~
      

  8.   

    if object_id('tempdb..#')is not null drop table #
    go
    create table #(ID int ,[Name] varchar(10))
    insert # select 1,'A'
    insert # select 2,null
    insert # select 3,''
    select * from # where [name] is null
    select * from # where [name]=''
    /*ID          Name       
    ----------- ---------- 
    2           NULLID          Name       
    ----------- ---------- 
    3           
    */