nasty11pig 2016-05-09 09:23 采纳率: 0%
浏览 1534

mssql ISNULL 空值转换小数位数问题

有个问题请老师帮我解决一下
select 6.66+1.11
结果为7.77 没有问题
select 6.66+1.11+isnull(a,0)
其中a为空值,结果为 7.8
select 6.66+1.11+isnull(a,0.000000001)
结果还是7.8
请问我如何得到7.77结果。

  • 写回答

1条回答

  • sxwws 2016-05-10 01:27
    关注

    mysql 上查询到的isnull 函数的用法,和你写的不一样。你要不检查一下。它的含义应该是test这个表达式是不是null,如果是null,返回1,否则返回0
    http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#function_isnull

    ISNULL(expr)

    If expr is NULL, ISNULL() returns 1, otherwise it returns 0.

    mysql> SELECT ISNULL(1+1);
    -> 0
    mysql> SELECT ISNULL(1/0);
    -> 1
    ISNULL() can be used instead of = to test whether a value is NULL. (Comparing a value to NULL using = always yields false.)

    The ISNULL() function shares some special behaviors with the IS NULL comparison operator. See the description of IS NULL.

    评论

报告相同问题?

悬赏问题

  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办