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.

    评论

报告相同问题?

悬赏问题

  • ¥30 vmware exsi重置后登不上
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面