11智能在线
新记
请问,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')
相似回答
大家正在搜
相关问题
在SQLSERVER中,如果被查询字段为空,则返回默认值的写...
数据库字段设置了默认值,插入数据时,该字段值为空,会覆盖了那...
sql中如何再判断一个字段是否为空,如果不为空然后再Sele...
查询的时候如果某个字段为NULL 让他默认为0的SQL语句怎...
sql如何判断字段的值是不是空值
sql 语句中如何判断当一个字段是负数或null时,让这个字...
sql查询问题,如果一个条件为空,则默认查找全部,该怎么写s...
在sql语句查询时如何把查询为空的数据显示为零