SQLServer获取值为空的结果 [英] SQLServer Get Results Where Value Is Null

查看:299
本文介绍了SQLServer获取值为空的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个要查询的SQL Server数据库,我只想在特定行为null时获取信息.我使用了where语句,例如:

I have an SQL server database that I am querying and I only want to get the information when a specific row is null. I used a where statement such as:

WHERE database.foobar = NULL

,它不返回任何内容.但是,我知道至少有一个结果,因为我在数据库中创建了一个实例,其中'foobar'等于null.如果我取出where语句显示数据,那么我知道它不是查询的其余部分.

and it does not return anything. However, I know that there is at least one result because I created an instance in the database where 'foobar' is equal to null. If I take out the where statement it shows data so I know it is not the rest of the query.

有人可以帮我吗?

推荐答案

正确的语法是WHERE database.foobar IS NULL.请参见 http://msdn.microsoft.com/en-us/library/ms188795. aspx 了解更多信息

Correct syntax is WHERE database.foobar IS NULL. See http://msdn.microsoft.com/en-us/library/ms188795.aspx for more info

这篇关于SQLServer获取值为空的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆