|
CREATE TYPE
Create an alias data type or user-defined type (CLR) in the current database.
Syntax CREATE TYPE [schema.] type FROM base_type [ ( precision [ , scale ] ) ] [NULL | NOT NULL] [;] CREATE TYPE [schema.] type EXTERNAL NAME assembly_name [.class] [;] Key type Name of the type (alias or user-defined) to create. base_type A SQL Server supplied data type on which type is to be based. precision The max no. of decimal digits that can be stored, both to the left and to the right of the decimal point. scale The max no. of decimal digits that can be stored to the right of the decimal point ( <= precision) NULL Whether or not the type can hold a null value. assembly_name Assembly that references the implementation of the user-defined type in the common language runtime.
The 'public' database role is not automatically granted REFERENCES permission on types that are created by using CREATE TYPE.
Example
CREATE TYPE SS64
FROM varchar(25) NOT NULL ;
"A chic type, a rough type, an odd type - but never a stereotype" - Jean-Michel Jarre
Related commands:
sp_addtype
DROP TYPE
CREATE ASSEMBLY
EVENTDATA()
Equivalent Oracle command:
CREATE TYPE