O'Reilly logo

Microsoft® SQL Server 2008 R2 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Developing Managed Stored Procedures

Stored procedures are a great starting point for getting into SQLCLR because they are easy to implement. To do so, right-click your new project in VS’s Solution Explorer and then select Add, Stored Procedure. Name your new class StoredProcedures.cs. A partial class of that name opens in the VS code window. Note that VS automatically adds the required reference to Microsoft.SqlServer.Server and its associated using statement. Microsoft.SqlServer.Server contains the SqlProcedure attribute required for turning ordinary methods into SQLCLR stored procedures.

Change your autogenerated method name from StoredProcedures to GetProductReviews. Next, if you’re not working in VS, you need to decorate this method with ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required