When a Default Is Applied

Defaults are applied only when no value is specified for a column during an insertion. They can also be applied during insertions and updates when the DEFAULT keyword is used. To demonstrate the application of defaults, consider the following examples:

image

The table in this example has a unique characteristic: each column has some sort of default value associated with it. One column has a default of NULL because it is nullable. The IDENTITY and TIMESTAMP columns automatically generate values because of their data type, and the password column has an explicit default definition. In this scenario, you can supply the keywords ...

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.