Click here to Skip to main content
15,936,677 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted

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[^].
 
Share this answer
 
v2
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
 
Share this answer
 
v2
Use
sp_help Table1


you will get all the details about the table.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900