Microsoft's explanation:
Create an object called the default value. When bound to a column or alias data type, if no value is explicitly provided during insertion, a value is specified by default to insert it into the column bound to the object (or, if the data type is an alias, all columns are inserted ).
This function will be deleted in later versions of Microsoft SQL Server. Avoid using this function in new development work, and start to modify the application that is currently using this function.
Syntax
CREATE DEFAULT [ schema_name . ] default_nameAS constant_expression [ ; ]
Parameters
-
Schema_name
-
The name of the default schema.
-
Default_name
-
The default value. The default name must comply with the identifier rules. You can choose whether to specify the default owner name.
-
Constant_expression
-
It only contains regular value expressions (it cannot contain the names of any column or other database objects ). Except for expressions that contain alias data types, you can use any constant, built-in function, or mathematical expression. You cannot use user-defined functions. Character and date constants must be placed in single quotes ('); No quotation marks are required for currencies, integers, and floating-point constants. Binary data must start with 0x, and currency data must begin with the dollar sign ($. The default value must be compatible with the column data type.
Example: create default time
----- Create Default defadefadate AS GetDate () ----- bind the Default value to the specified column EXEC sp_binDefault @ DefName = MyDate, @ ObjName = 'product. Made 'in the table to bind the Default value.