sys.types (Transact-SQL)

Contains a row for each system and user-defined type.

Column name Data type Description

name

sysname

Name of the type. Is unique within the schema.

system_type_id

tinyint

ID of the internal system-type of the type.

user_type_id

int

ID of the type. Is unique within the database. For system data types, user_type_id = system_type_id.

schema_id

int

ID of the schema to which the type belongs.

principal_id

int

ID of the individual owner if different from schema owner. By default, schema-contained objects are owned by the schema owner. However, an alternate owner can be specified by using the ALTER AUTHORIZATION statement to change ownership.

NULL if there is no alternate individual owner.

max_length

smallint

Maximum length (in bytes) of the type.

-1 = Column data type is varchar(max), nvarchar(max), varbinary(max), or xml.

For text columns, the max_length value will be 16.

precision

tinyint

Max precision of the type if it is numeric-based; otherwise, 0.

scale

tinyint

Max scale of the type if it is numeric-based; otherwise, 0.

collation_name

sysname

Name of the collation of the type if it is character-based; other wise, NULL.

is_nullable

bit

Type is nullable.

is_user_defined

bit

1 = User-defined type.

0 = SQL Server 2005 system data type.

is_assembly_type

bit

1 = Implementation of the type is defined in a CLR assembly.

0 = Type is based on a SQL Server system data type.

default_object_id

int

ID of the stand-alone default that is bound to the type by using sp_bindefault.

0 = No default exists.

rule_object_id

int

ID of the stand-alone rule that is bound to the type by using sp_bindrule.

0 = No rule exists.

See Also

Reference

Catalog Views (Transact-SQL)
Scalar Types Catalog Views (Transact-SQL)
ALTER AUTHORIZATION (Transact-SQL)
OBJECTPROPERTY (Transact-SQL)

Other Resources

User-Schema Separation
Querying the SQL Server System Catalog FAQ

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

14 April 2006

Changed content:
  • Corrected the definition of max_length.