zoukankan      html  css  js  c++  java
  • SQL Server ISNULL

    ISNULL

    使用指定的替换值替换 NULL。

    语法

          ISNULL ( check_expression , replacement_value )
    参数
       check_expression  将被检查是否为 NULL的表达式。如果不为NULL,这直接返回 该值,也就是 check_expression 这个表达式。如果为空这个直接返回 replacement_value这个表达的内容。。。。check_expression 可以是任何类型的。replacement_value 必须与 check_expresssion 具有相同的类型。
     
    示例数据
    表tb_Student及其示例数据如下图所示。
     
    2.查询要求
       查询出其中成绩(score)小于等于60的学生信息保存至表变量@tempTable中,当学生成绩为空时,成绩记为0。
    复制代码
    复制代码
    1 declare @tempTable table(  
    2     stuname nchar(10),  
    3     stuage int,   
    4      stuscore float);  
    5 insert into @tempTable  
    6 select name,age,ISNULL(score,0) from tb_Student  
    7 where  ISNULL(score,0)<=60  
    8 select * from @tempTable  
    复制代码
    复制代码

    3 执行结果

  • 相关阅读:
    ubuntu 1804 docker install
    windows shortcut
    gallary
    g++ play
    linux profile
    terminator
    tmux
    ubuntu18
    windows toolkit
    windows terminal CLI
  • 原文地址:https://www.cnblogs.com/frankcui/p/10484327.html
Copyright © 2011-2022 走看看