DEFAULT
In a Relational Data model every column must have a value.
This value can allow NULLs. A DEFAULT defined assigns a value for
a column when the value is not supplied. Once created they can be
bound to a column or a user defined data type. They are effective
only when they are bound to specific columns or User Defined data
types.
Default value for state = 'TX'
Creating Default
defaults are created using the CREATE DEFAULT command. DEFAULT
names follow rules for identifiers, however, they can be created
only in the current database.
Syntax
CREATE DEFAULT as < constant expression >
Example
CREATE DEFAULT State_Default as "TX"
Binding a Default
Once DEFAULT has been defined it can be bound to one or
several columns, to a user defined data type using SP_BINDEFAULT
system stored procedure.
Syntax
SP_BINDEFALT <default>, <object>
Example
sp_bindefault state_default, "customer.state"
UnBinding a Default
When a DEFAULT is no longer needed it can be unbound from a
column or user defined data type using SP_UNBINDDEFAULT system
stored procedure.
Syntax
SP_UNBINDEFAULT <object>
Example
sp_unbindefault "customer.state"
Dropping a Default
We can drop the default object if you no longer need it.
Syntax
DROP DEFAULT < default name >
Example
drop default state_default