8.5. Introduction to CLR Integration

In this section, we discuss what it means to be a .NET runtime host, deploying .NET assemblies, maintaining security for .NET assemblies, and monitoring performance. Also included is a short example demonstrating how to debug a .NET assembly. This section is not about how to write a cool .NET assembly, although we do create a small assembly to further your understanding of how it works. This section focuses on administration.

For more information on SQL Server Integration Services, see Professional SQL Server 2008 Integration Services, by Brian Knight et al (Wrox, 2008); and to learn more about programming in SQL CLR, see Professional SQL Server 2005 CLR Stored Procedures, Functions, and Triggers, by Derek Comingore and Douglas Hinson (Wrox, 2007).

8.5.1. SQL Server As .NET Runtime Host

A runtime host is defined as any process that loads the .NET runtime and runs code in the managed environment. The database programming model in SQL Server 2008 is significantly enhanced by hosting the Microsoft .NET Framework 3.5 Common Language Runtime (CLR). With CLR integration, also called SQL CLR, SQL Server enables .NET programmers to write stored procedures, user-defined functions, and triggers in any .NET-compatible language, particularly C# and VB.NET.

The .NET code that SQL Server runs is completely isolated from SQL Server itself. Of course, .NET code runs in the SQL Server process space, but SQL Server uses a construct in .NET called the AppDomain ...

Get Professional Microsoft® SQL Server® 2008 Administration now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.