This question popped up on the MSDN forum today: Status of BIT type columns
Here is a way to quickly find all the columns in your database which allow NULLS
- SELECT table_name,column_name
- FROM information_schema.columns
- WHERE is_nullable ='YES'
- ORDER BY table_name,column_name
Now you might have noticed that some of these are views. You can join with information_schema.tables and filter on table_type = 'base table' to list just the tables.
- SELECT c.table_name,c.column_name,t.table_type
- FROM information_schema.columns c
- join information_schema.tables t ON c.table_name = t.table_name
- WHERE is_nullable ='YES'
- and table_type = 'base table'
- ORDER BY table_name,column_name
To list all the columns in your database regardless if they are in a view or a table and if they allow NULLS or not use this
- SELECT table_name,column_name,is_nullable
- FROM information_schema.columns
- ORDER BY table_name,column_name
You can also find this in our SQL Server Admin Hacks wiki
*** If you have a SQL related question try our Microsoft SQL Server Programming forum or our Microsoft SQL Server Admin forum






LTD Social Sitings
Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.