List all Default Values in a SQL Server Database

Hello Everyone,

See the below query to find the default value of all columns in all tables of a database.

SELECT obj.name as 'Table', col.name as 'Column',
object_definition(default_object_id) AS [DefaultValue]
FROM   sys.objects obj INNER JOIN sys.columns col
ON obj.object_id = col.object_id
where obj.type = 'U' AND object_definition(default_object_id) IS NOT NULL