The default value (default) is data that is automatically inserted in a column that does not specify specific data when the user enters a record. The default value object is similar to the default value specified by the "default" option when the ALTER TABLE or CREATE TABLE command action table, but the default value object can be used with multiple columns or user-defined data types, and its management and application have many similarities to the rules. A column of a table or a user-defined data type can only be bound to a default value.
9.3.1 Create default values
(1) Create default value with creation default command
The Create default command is used to create a default value object in the current database with the following syntax:
CREATE DEFAULT Default_name as Constant_expression
Where the constant_expression clause is the definition of the default value. The constant_expression clause can be a mathematical expression or function, or it can contain a table's column name or other database object.
Example 9-11: Create a birthday default value Birthday_defa.
Create Default Birthday_defa
As ' 1978-1-1 '
Example 9-12: Create a name default value Name_defa.
Create Default Name_defa
As user
(2) Create default values with Enterprise Manager
Select the database object "Defaults" in Enterprise Manager, right-click, and select N "ew Default" from the shortcut menu, which pops up the Create Default Properties dialog box as shown in Figure 9-6. After you enter the default value name and value expression, click OK to complete the creation of the default value.
9.3.2 View default values
(1) Use Enterprise Manager to view default values
Select the "Defaults" object in enterprise Manager to see most of the default values from the taskpad on the right. As shown in Figure 9-7. You can also select the default value to view, right-click, and choose Properties from the shortcut menu, which shows the default Value Properties dialog box shown in Figure 9-8, where you can edit the default value of the