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 执行结果

SQL Server - ISNULL的更多相关文章

  1. SQL Server -ISNULL()函数

    SQL中有多种多样的函数,下面将为您介绍SQL中的ISNULL函数,包括其语法.注释.返回类型等,供您参考,希望对您学习SQL能够有所帮助. ISNULL 使用指定的替换值替换 NULL. 语法ISN ...

  2. sql server isnull函数

    isnull函数 --ISNULL() 函数用于规定如何处理 NULL 值 语法:SELECT ISNULL(check_expression, replacement_value) --check_ ...

  3. sql server相关

    sql server nolock 在sqlserver 中with(nolock)详解   所有Select加 With (NoLock)解决阻塞死锁 在查询语句中使用 NOLOCK 和 READP ...

  4. sql server vs mysql

    1.中文: my.ini [mysqld] character-set-server=utf8 character-set-client=utf8 data\testdb\db.opt default ...

  5. SQL Server里的 ISNULL 与 NULLIF

    SQL Server 中有两个參数,语法:     ISNULL(check_expression, replacement_value) check_expression 与 replacement ...

  6. Orcale的NVL、NVL2函数和SQL Server的ISNULL函数

    Orcal 的 nvl函数 NVL(Expr1,Expr2)如果Expr1为NULL,返回Expr2的值,否则返回Expr1的值,Expr1,Expr2都为NULL则返回NULL NVL2(Expr1 ...

  7. sql server函数(isnull,charindex,cast,自定义函数)

    SELECT charindex( CAST ( dbo.ufn_IsNullOrEmpty ('109722A3-622D-4FD4-A060-0287C933A89E', a.OUID) AS V ...

  8. SQL Server里的 ISNULL 与 NULLIF(转)

    SQL Server 中有两个参数,语法:     ISNULL(check_expression, replacement_value) check_expression 与 replacement ...

  9. sql server 知识整理 isnull函数()

    exec sp_helptext ProPrecode_matcode_uf exec sp_helptext 存储过程名字 isnull 函数() SQL Serve中的isnull()函数: is ...

随机推荐

  1. loadrunner脚本函数讲解

    一. get请求和post请求区别:web_link(get).web_submit_form(post)依赖上下文,web_url.web_submit_data不依赖上下文,建议使用web_url ...

  2. (五)Cluster Health

    Let’s start with a basic health check, which we can use to see how our cluster is doing. We’ll be us ...

  3. python scapy dns 包字段解析

    qr:   0表示查询报文,1表示响应报文opcode: 通常值为0(标准查询),其他值为1(反向查询)和2(服务器状态请求).aa: 表示授权回答(authoritative answer)tc: ...

  4. pyspider爬虫框架webui简介-爬取阿里招聘信息

    命令行输入pyspider开启pyspider 浏览器打开http://localhost:5000/ group表示组名,几个项目可以同一个组名,方便管理,当组名修改为delete时,项目会在一天后 ...

  5. asp.net core 2.1认证

    asp.net core 2.1认证 这篇文章基于asp.net core的CookieAuthenticationHandler来讲述. 认证和授权很相似,他们的英文也很相似,一个是Authenti ...

  6. 转:Flutter动画二

    1. 介绍 本文会从代码层面去介绍Flutter动画,因此不会涉及到Flutter动画的具体使用. 1.1 Animation库 Flutter的animation库只依赖两个库,Dart库以及phy ...

  7. springboot 静态注入 单例

    package com.b2q.web_push.util; import io.goeasy.GoEasy; import org.springframework.beans.factory.ann ...

  8. Ubuntu 14.04 mame sound fix

    sudo vi '/etc/mame/mame.ini' samplerate 22050

  9. H5的表格

    表格标签<table> 绘制表格的标签:<table>标签 表格标题:<caption>标签 表格宽度与高度:width和height属性 表格边框色:border ...

  10. Linux 学习 (六) 关机与重启命令

    Linux达人养成计划 I 学习笔记 shutdown [选项] 时间 -c:取消前一个关机命令 -h:关机 -r:重启 shutdown命令会在关机或重启时自动保存系统中正在运行的服务,最安全的关机 ...