Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
Topic |
Description |
---|---|
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.
Please sign in to use this experience.
Sign in