Get List of All Null and Not Null Columns in SQL Server Database - SQL Server / T-SQL Tutorial Part 53


You are working as SQL Server Developer, You are doing some analysis and want to get the list of all columns in SQL Server Database which are Nullable or Not Nullable.How would you get this information?


We can use system views in SQL Server to get this information. Below Query will return us Database Name, Schema Name, Table Name, Column Name,Data Type and IS_Nullable.

SELECT Table_CataLog AS DBName
  --Uncomment the Where Clause if you want to filter the records
  --where TABLE_SCHEMA = 'dbo' and TABLE_NAME = 'TableName' and COLUMN_NAME = 'ColumnName'

How to get list of Nullable and Non-Nullable Columns in SQL Server Database- TSQL Tutorial