CREATE TYPE
defines a user-defined type
What changes
- Input
- catalog
- Output or change
- alias type, table type (for TVPs / table variables), or CLR type
Syntax at a glance
CREATE TYPE [ schema_name. ] type_name { FROM base_type [ ( precision [ , scale ] ) ] [ NULL | NOT NULL ] | EXTERNAL NAME assembly_name [ .class_name ] | AS TABLE ( { <column_definition> | <computed_column_definition> [ , ...n ] [ <table_constraint> ] [ , ...n ] [ <table_index> ] [ , ...n ] } ) } [ ; ]
Work example
Several routines need the same user-defined data type or table-valued parameter shape.
Review the base type, nullability, collation, and callers before publishing a dependent procedure.
Check your work Every caller binds the type with matching column order and compatible values.
Open Microsoft Learn for full syntax, permissions, and details for your version.