Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2000
Tables
Designing Tables
 Creating User-Defined Data Types
Creating and Maintaining Databases (SQL Server 2000)
Creating User-Defined Data Types

Creating User-Defined Data Types

User-defined data types are based on the system data types in Microsoft® SQL Server™ 2000. User-defined data types can be used when several tables must store the same type of data in a column and you must ensure that these columns have exactly the same data type, length, and nullability. For example, a user-defined data type called postal_code could be created based on the char data type. User-defined data types are not supported in table variables.

When a user-defined data type is created, you must supply these parameters:

  • Name

  • System data type upon which the new data type is based

  • Nullability (whether the data type allows null values)

    When nullability is not explicitly defined, it will be assigned based on the ANSI null default setting for the database or connection.

Note  If a user-defined data type is created in the model database, it exists in all new user-defined databases. However, if the data type is created in a user-defined database, the data type exists only in that user-defined database.

To create user-defined data types

Transact-SQL

Enterprise Manager

Enterprise Manager

SQL-DMO

To delete user-defined data types

Transact-SQL

Enterprise Manager

Enterprise Manager

SQL-DMO

See Also

ALTER TABLE

CREATE TABLE

Using Data Types

© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker