Dev Dev - 2 months ago 7
SQL Question

How to check if a column has not null constraint?

I am using SQL Server 2008 R2.

I have a table in which I have a column that have a not null constraint.

Now, what if I want to check if column has not null constraint defined or not for specific column?

Is there any query to find out it?

Thanks in advance..

Ric Ric
Answer
SELECT  *
FROM    INFORMATION_SCHEMA.COLUMNS

Show's all columns from all tables and a whole host of information on them. The column you would want is: IS_NULLABLE that can have the value 'YES' or 'NO'