请问,sql 如何判断如果这个字段的数值为空 则默认为0,谢谢

空值为(NULL) 用nvl函数好像不行,数据库是SQL2000

第1个回答  推荐于2018-05-09
用nvl函数, select nvl(字段名,0)from table_name .nvl的具体用法可参见百度百科。

参考资料:http://baike.baidu.com/view/1091825.htm

本回答被提问者和网友采纳
第2个回答  2010-11-14
select case when 字段名 is null then 0 end from 表名
第3个回答  2010-11-14
case when 字段 is null then '0' end
第4个回答  2019-11-18
Isnull(字段,'0')
相似回答