First, the user-defined data type creation: 1. Execute the system stored procedure: exec sp_addtype type, system_data_type [, 'null_type', oowner_name]
· Type custom data type name must ensure that the identifier rules are in line with the identifier rules, and the only database is unique. · System_data_type is a data type based on a custom data type, which can include length, accuracy, scale, and the like. • NULL_TYPE Defines how user-defined data types to handle null values. Can take 'Null', 'Not Null', Nonull
2, add this in the Enterprise Manager, this is very simple.
Second, the creation of the rules: 1. Execute DDL definition: create rule rule_name as condition_exepression
· Rule_name rule name · Condition_exepression rule expression] @spaceholder like rule_string where @Spaceholder is a space flag is a parameter with @, for example: @ liu, @ jin, @ cai, @ northsnow, etc. Like is a must_string is a must Regular expression.
2. Add this very simple in enterprise management.
Third, the default creation 1, execute DDL definition: create default default_name as constant_exepression
· Default_name Default name · constant_exepression constant expression, can constant, function, such as: getdate ()
2. Add this very simple in enterprise management.
Fourth, Binding Default and Rules 1. Execute the system stored procedure definition: Exec sp_binddefault default name, custom data type name
EXEC SP_BINDRULE Rules Name, custom data type name
2, binding in enterprise manager
5. Creating a table (application has been created custom data type)
Application method is exactly the same as the system type
CREATE TABLE TABLE_NAME (Field_name Type_name)