Chapter 27. Programming CLR Assemblies within SQL Server

In This Chapter

  • A crash course in the .NET Framework

  • Overview of the CLR SQL Server types

  • .NET language support for CLR integration

  • T-SQL CLR DDL commands and catalog views

  • Building database types with Visual Studio

  • When to use CLR versus T-SQL

With SQL Server 2005, the .NET Framework's common language runtime (CLR) becomes available within SQL Server. The CLR produces more scalable complex logic and calculations at the database level through stored procedures, functions, triggers, and user-defined aggregations. The CLR also adds the capability to more accurately model the real world that the database supports, with user-defined types. While T-SQL continues to be the optimal data access tool, the CLR should be viewed as a new dimension of flexibility in n-tier datacentric application design. Before CLR integration, it was necessary to either endure the slow computational facilities within T-SQL or move large amounts of data on the wire before crunching to produce a relatively smaller result for ultimate consumption by the application. With CLR integration, the best of both is possible, provided the hardware under the SQL Server and the developer behind the keyboard are both up to the task.

Note

The individual letters of the abbreviation CLR are frequently pronounced "clear" by many developers. Neither the individual letters nor "clear" is more technically correct. Both pronunciations are in use.

SQL Server does not merely use the .NET ...

Get SQL Server™ 2005 Bible now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.