码迷,mamicode.com
首页 > 数据库 > 详细

SqlServer--空值处理

时间:2016-12-16 01:35:02      阅读:220      评论:0      收藏:0      [点我收藏+]

标签:空值   无法   server   not   where   null   计算   sql   bsp   

 

select * from TblStudent

 

--查询所有年龄是null的同学信息

--null值无法使用=或<>来进行比较

--unknown

--判断null值必须使用is null或者is not null

select * from TblStudent where tsage is null

select * from TblStudent where tsage=null

 

--查询所有年龄不是null的同学

select * from TblStudent where tsage<>null

select * from TblStudent where tsage is not null

 

select * from TblStudent where tsage=25

select * from TblStudent where tsage<>25

 

--任何值与null进行计算,得到的结果还是null

select 2000+null

 

SqlServer--空值处理

标签:空值   无法   server   not   where   null   计算   sql   bsp   

原文地址:http://www.cnblogs.com/hao-1234-1234/p/6185243.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!