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.