Declarative Defaults
A declarative default is a constraint defined as part of the table definition. Using declarative defaults is the preferred method for assigning default values to columns. You can use the CREATE TABLE
or ALTER TABLE
statement to create a default and assign it to a column. Declarative defaults are assigned to a single column and cannot be reused for other columns in the database. The following example shows the creation of a new column named CustomerType
in the Sales Customer
table followed by the creation of a new default on that column:
It is important to remember that a default constraint stores the default value only when ...
Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.