Chapter 20. .NET Programming with SQL Server 2005

.NET 2.0 is a simultaneous release with the new version of SQL Server. SQL Server 2005 is a new host of the .NET runtime, and therefore it allows running .NET assemblies in the SQL Server process. It enables you to create stored procedures, functions, and data types with a .NET programming language such as C# and Visual Basic.

This chapter looks at the following:

  • Hosting the .NET runtime with SQL Server

  • Classes from the namespace System.Data.SqlServer

  • Creating user-defined types

  • Creating user-defined aggregates

  • Stored procedures

  • User-defined functions

  • Triggers

  • XML data types

SQL Server 2005 also has many new features that are not directly associated with the CLR, such as many T-SQL improvements, but they are not covered in this book. To get more information about these features you can read Wrox's SQL Server 2005 Express Edition Starter Kit (Wiley Publishing, Inc., ISBN 0-7645-8923-7).

.NET Runtime Host

SQL Server 2005 is a new host of the .NET runtime. In versions prior to .NET 2.0, the .NET runtime can be hosted with Web applications from ASP.NET and Windows Forms controls can run in the Internet Explorer runtime host.

SQL Server 2005 allows running a .NET assembly inside the SQL Server process, where it is possible to create stored procedures, functions, data types, and triggers with CLR code.

Every database that makes use of CLR code creates its own application domain. This guarantees that CLR code from one database doesn't have any influence ...

Get Professional C# 2005 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.