Bagikan melalui


How to: Create User-Defined Data Types (SQL Server Management Studio)

Use Object Explorer to create new user-defined data types.

To create a user-defined data type

  1. In Object Explorer, expand Databases, expand a database, expand Programmability, expand Types, right-click User-defined Data Types, and then click New User-defined Data Type.

  2. In the New User-defined Data Type dialog box, in the Schema box, type the schema to own this data type, or use the browse button to select the schema.

  3. In the Name box, type a name for the new data type.

  4. In the Data type box, select the data type that the new data type will be based on.

  5. Complete the Length, Precision, and Scale boxes if appropriate for that data type.

  6. Check Allow NULLs if the new data type can permit NULL values.

  7. In the Binding area, complete the Default or Rule boxes if you want to bind a default or rule to the new data type. Defaults and rules cannot be created in SQL Server Management Studio. Use Transact-SQL. Example code for creating defaults and rules are available in Template Explorer.