我的数据类型为Float[code] select case when AA='' then 'AAA'
when AA is null then 'BBB'
end ,
AA from TABLEA [/code]
为什么我的AA为0 时显示AAA??
难道Float的空 默认为 0???
when AA is null then 'BBB'
end ,
AA from TABLEA [/code]
为什么我的AA为0 时显示AAA??
难道Float的空 默认为 0???
when AA is null then 'BBB'
end ,
AA from TABLEA
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 個資料列)*/
如果用float觉得不好,用decimal.
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
*/