How to find default values of all SQL Server columns

20 March,2023 by Tom Collins

Question: Do you have a sql query to check every  sql server database  column and identify if a default value is applied to the column?  


Answer : This query example will return 3 columns - table, column , and default column value 


use [myDB]

FROM dbo.sysobjects so INNER JOIN dbo.syscolumns sc ON = 
LEFT JOIN dbo.syscomments sm ON sc.cdefault = 
WHERE so.xtype = 'U' AND sm.TEXT IS NOT NULL
ORDER BY so.[name], sc.colid   

Read more on finding other SQL database objects 

List Foreign Keys referencing tables in SQL Server

What are the triggers in SQL Server

How to find all identity columns in SQL Server

How to find computed columns on a SQL Server table

Find SQL Server LOB Columns

How to find SQL Filtered Indexes

Author: Tom Collins (


Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.


Post a comment on How to find default values of all SQL Server columns | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer