Working with Alias Data Types

Alias types are based on the system data types in SQL Server 2005. Alias types can be used when several tables must store the same type of data in a column and you have to make sure that these columns have identical data type, length, and nullability. For example, an alias type called postal_code could be created based on the char data type. Alias types are not supported in table variables.

When an alias data type is created, you must supply the following 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 an alias 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.

Note

When alias data types are dropped, they can still be referenced by table variables later in the batch in which they were dropped.

See Also

Concepts

Data Types (Database Engine)

Other Resources

CREATE TYPE (Transact-SQL)
DROP TYPE (Transact-SQL)
ALTER TABLE (Transact-SQL)
CREATE TABLE (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance