T-SQL 101: 130 What are Default Constraints in T-SQL?
Default constraints allow us to automatically provide values for columns when:
we don’t supply them ourselves they are marked as NOT NULL so they are required When you’re building an INSERT statement, you don’t have to give values for all columns. Columns that are declared as NULL aren’t mandatory, so you don’t have to supply those columns at all. Those columns can just be NULL.
But if you have a column that is declared as NOT NULL, so it requires a value, but you haven’t supplied it in the INSERT statement, then a default constraint can provide the value.
2025-03-16