查询以检查列是否可为空 [英] Query to check whether a column is nullable
本文介绍了查询以检查列是否可为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
查询一列是否可以为空(列中是否允许空值).它最好应该返回 yes/no 或 1/0 或 true/false.
Query to check whether a column is nullable (null values are allowed in the column or not). It should preferably return yes/no or 1/0 or true/false.
推荐答案
您也可以使用 COLUMNPROPERTY
和 OBJECT_ID
元数据函数:
You could also use the COLUMNPROPERTY
and OBJECT_ID
metadata functions:
SELECT COLUMNPROPERTY(OBJECT_ID('SchemaName.TableName', 'U'), 'ColumnName', 'AllowsNull');
这篇关于查询以检查列是否可为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文