How to specify a default value for a column in SQL Server Table Designer

Developers can specify a default value, for each column in their table, which will be entered in the column if the end user leaves it blank. When developers do not assign a default value and the user leaves it blank, then:

-If developers set the option to allow null values, NULL will be inserted into the column.

-If developers do not set the option to allow null values, the column will remain blank, but the user will not be able to save the row until they supply a value for the column.

Developers should follow the next rules when they are specifying the default values:

-To enter a numeric default, they enter the number.

-To enter a object/function they enter the name of the object/function with no single quotes around it.

– To enter an alphanumeric default they enter the value with single quotes around it.

-For text strings, they enclose the value in single quotation marks (‘); they do not use double quotation marks (“) because they are reserved for quoted identifiers.

When developers working with SQL Server “Denali”, MS SQL Server 2008 R2 and MS SQL Server 2005 want to specify a default value for a column, they should follow the next steps:

1. In Object Explorer, right-click the table with columns for which they want to specify a default value and click Design (Modify in SP1 or earlier).

The table opens in Table Designer.

2. Select the column for which they want to specify a default value.

3. In the Column Properties tab, enter the new default value in the Default Value or Binding property or select a default binding from the drop-down list.