Working with CLR User-defined Types
You can create a database object inside SQL Server that is programmed against an assembly created in the Microsoft .NET Framework common language runtime (CLR). Database objects that can take advantage of the rich programming model provided by the CLR include triggers, stored procedures, functions, aggregate functions, and types.
You can extend the SQL type system by defining a custom data type for use in SQL Server programming. A user-defined type (UDT) may be simple or structured and of any degree of complexity. It can encapsulate complex, user-defined behaviors. A user-defined type is implemented as a managed class in any one of the CLR languages, and then registered with SQL Server. A user-defined type can be used to define the type of a column in a table, or a variable or routine parameter in the Transact-SQL language. An instance of a user-defined type can be a column in a table, a variable in a batch, function or stored procedure, or an argument of a function or stored procedure.
The following topics provide additional information about working with user-defined types.
Lists the steps that you require to create or drop a user-defined type, with links to the topics required for completing each step.
Explains how to insert and modify column values and change the values of user-defined type variables and parameters.
Explains how to modify user-defined type variables and parameters in a SET statement or in the SELECT list of a SELECT statement.
Explains how to perform a variety of operations on instances of user-defined types.
Explains how to convert a user-defined type value from one database for use in another database.
For sample applications that demonstrate how to create and use CLR-based database objects, including user-defined types, in SQL Server, see the CLR Programmability Samples. For information about samples, see Considerations for Installing SQL Server Samples and Sample Databases.