Query below lists default constraints defined in the database ordered by constraint name.
Check this query to see them organized by table.
select con.[name] as constraint_name, schema_name(t.schema_id) + '.' + t.[name] as [table], col.[name] as column_name, con.[definition] from sys.default_constraints con left outer join sys.objects t on con.parent_object_id = t.object_id left outer join sys.all_columns col on con.parent_column_id = col.column_id and con.parent_object_id = col.object_id order by con.name
- constraint_name - name of the constraint in the database
- table - schema and table name constraint is defined for
- column_name - name of the column
- definition - SQL expression that defines this default constraint
- One row represents one default constraint
- Scope of rows: query returns all default constraints in the database (all columns with default constraints)
- Ordered by constraint name
List of default constraints in AdventureWorks database.