![](http://image.absoluteastronomy.com/images//topicimages/noimage.gif)
SQL CLR
Encyclopedia
SQL CLR or SQLCLR is technology for hosting of the Microsoft .NET common language runtime engine within SQL Server. The SQLCLR allows managed code
to be hosted by, and run in, the Microsoft SQL Server
environment.
This technology, introduced in Microsoft SQL Server 2005, allow users for example to create the following types of managed code objects in SQL Server in .NET languages such as C# or VB.NET.
The SQL CLR relies on the creation, deployment, and registration of .NET assemblies, which are physically stored in managed code dynamic load libraries (DLLs). These assemblies may contain .NET namespaces, classes, functions and properties.
Managed code
Managed code is a term coined by Microsoft to identify computer program code that requires and will only execute under the "management" of a Common Language Runtime virtual machine ....
to be hosted by, and run in, the Microsoft SQL Server
Microsoft SQL Server
Microsoft SQL Server is a relational database server, developed by Microsoft: It is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network...
environment.
This technology, introduced in Microsoft SQL Server 2005, allow users for example to create the following types of managed code objects in SQL Server in .NET languages such as C# or VB.NET.
- Stored procedureStored procedureA stored procedure is a subroutine available to applications that access a relational database system. A stored procedure is actually stored in the database data dictionary.Typical uses for stored procedures include data validation or access control mechanisms...
s (SPs) which are analogous to procedures or void functions in procedural languages like VB or C, - triggersDatabase triggerA database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database. The trigger is mostly used for keeping the integrity of the information on the database...
which are stored procedures that fire in response to Data Manipulation LanguageData Manipulation LanguageA data manipulation language is a family of syntax elements similar to a computer programming language used for inserting, deleting and updating data in a database...
(DML) or Data Definition LanguageData Definition LanguageA data definition language or data description language is a syntax similar to a computer programming language for defining data structures, especially database schemas.-History:...
(DDL) events, - User-defined functions (UDFs) which are analogous to functions in procedural languages,
- User-defined aggregates (UDAs) which allow developers to create custom aggregates that act on sets of data instead of one row at a time,
- User-defined types (UDTs) that allow users to create simple or complex data types which can be serialized and deserialized within the database.
The SQL CLR relies on the creation, deployment, and registration of .NET assemblies, which are physically stored in managed code dynamic load libraries (DLLs). These assemblies may contain .NET namespaces, classes, functions and properties.