Database Reference
In-Depth Information
Creating a SQL CLR Stored Procedure
Microsoft Visual Studio 2012 provides the project template and class files for various SQL Server objects
such as stored procedures, triggers, functions, and so on, which you can code in C# as an assembly such
as a dynamic link library (DLL).
Try It: Creating a SQL CLR Stored Procedure Using C#
In this exercise, you'll create a SQL stored procedure by adding a SQL CLR C# stored procedure item
template into the SQL Server database project. The SQL CLR C# stored procedure you will create will
help you insert currency data into the AdventureWorks.Sales.Currency table, as you did in Chapter 13
with Listing 13-4. But here you are using a different technique to accomplish the same task (currency
insertion).
1. Create a new Windows Forms Application project named Chapter13. When
Solution Explorer opens, save the solution, as shown in Figure 20-3.
Figure 20-3. Showing the SQL Server Database Project template
2. This will load an empty project, that is, one without any .cs class file in it, as
shown in Figure 20-4.
 
Search WWH ::




Custom Search