sql server 知识整理 isnull函数()

exec sp_helptext ProPrecode_matcode_uf

exec sp_helptext 存储过程名字

isnull 函数()

SQL Serve中的isnull()函数:
         isnull(value1,value2)

        1、value1与value2的数据类型必须一致。

        2、如果value1的值不为null,结果返回value1。

        3、如果value1为null,结果返回vaule2的值。vaule2是你设定的值。



       如果在select中就是isnull可以判断是否是null,如果是给个默认值,isnull("字段名","设定默认的数据")
      

       例如:select isnull(fs,6) from xuesheng where name='张三'  在表xuesheng中,fs分数如果为空,结果输出8。如果不为空,输出fs

的值。



      同时要注意,在sql server中字段为空的写法,select name,fs from xuesheng where name is nullis not null 而不是name=null、

name=' '
原文地址:https://www.cnblogs.com/baili-luoyun/p/11057385.html