Useful links:
- Introduction to SQL Server CLR Integration
- CLR User-Defined Functions
- CLR User-Defined Types
- CLR Stored Procedures
- CLR Triggers
- SQL# CLR functions (by Sql Quantum Lift)
The common language runtime (CLR) is the heart of the Microsoft .NET Framework and provides the execution environment for all .NET Framework code. Code that runs within the CLR is referred to as managed code. The CLR provides various functions and services required for program execution, including just-in-time (JIT) compilation, allocating and managing memory, enforcing type safety, exception handling, thread management, and security.
With the CLR hosted in Microsoft SQL Server (called CLR integration), you can author stored procedures, triggers, user-defined functions, user-defined types, and user-defined aggregates in managed code. Because managed code compiles to native code prior to execution, you can achieve significant performance increases in some scenarios.
Enabling CLR Integration:
EXEC sp_configure 'clr enabled', 1;
RECONFIGURE;
GO