A user-defined datatype must be created in each database in which it will be used. Create frequently used datatypes in the model database. These datatypes are automatically added to each new database (including tempdb, which is used for temporary tables) as it is created.
A table owner can define user-defined datatypes.
Creating a user-defined datatype
In the database hierarchy, select the User-defined Datatypes folder.
Select | File | New | User-defined Datatype. The User-defined Datatype creation wizard opens.
In the Name box, enter a name for the user-defined datatype.
Go to Advanced Options tab.
From the System Data Type list, select a system datatype on which to base the user-defined datatype.
If the datatype is char, unichar, varchar, univarchar, binary, varbinary, nchar, or nvarchar, enter a maximum length for the datatype in the Size box.
The numeric and decimal datatypes expect a precision and scale, in parentheses and separated by a comma. Precision is the maximum number of decimal digits that can be stored in the column. The range is 1 to 38. Scale is the maximum number of digits to the right of the decimal point.
The scale must be less than or equal to the precision. The range is 0 to 38.
In the Null Setting group box, specify how the user-defined datatype handles null values. To specify that the datatype can accept null values, select Allow nulls. To specify that the datatype does not accept null values, select Do not allow nulls. To specify that the datatype can use the system identity property to identify each row in the table, select Identity. Only one column can have the identity property.
To create a user-defined datatype with the IDENTITY property, the new type must be based on a physical type of numeric with a scale of 0.
To bind the user-defined datatype to a default, select a default from the Default list.
To bind the user-defined datatype to a rule, select a rule from the Rule list.
Click Finish.
Select the User-defined Datatypes folder. In the right pane, double-click the Add User-defined Datatype icon.