如何在sql表中识别空字段 [英] how to identify null fields in sql table

查看:99
本文介绍了如何在sql表中识别空字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用sql查询获取哪些字段允许为null和不为null

是否存在用于标识空字段和非空字段的查询?

How can i get which fields are allow null and not null using sql query

is there query for identifying null and not null fields

推荐答案

NULL 表示该值未知.
因此,请检查任何列中的NULL 或不为null.
有关更多信息,请参见 http://msdn.microsoft.com/en-us/library/ms191504.aspx [ ^ ].
A value of NULL indicates that the value is unknown.
So check any column for NULL or not null.
For more information - see http://msdn.microsoft.com/en-us/library/ms191504.aspx[^].


尝试一下.
Try this.
SELECT * FROM INFORMATION_SCHEMA.COLUMNS a
 WHERE a.TABLE_NAME=''tablename''
   AND IS_NULLABLE = ''No'' -- NO for not null and YES for null


使用
sp_help Table1



您将获得有关该表的所有详细信息.



you will get all the details about the table.


这篇关于如何在sql表中识别空字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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