Creating Database Objects in Managed Code

Database objects are commonly implemented using some dialect of the SQL language. This is true with SQL Server as well, and as we have just reviewed, the Visual Studio database project allows you to craft your database objects using SQL. But using that same project, you can also design database objects using C#.

SQL Server 2005 introduced the capability of authoring SQL objects in managed code. So, instead of using Transact SQL, you can actually write your stored procedures, queries, views, and so on using C#. These are run under the auspices of SQL Server’s own version of the .NET Common Language Runtime (CLR).

The SQL Server CLR supports a variety of object types that can be written in C#:

Stored ...

Get Microsoft Visual Studio 2015 Unleashed, Third Edition 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.