YukonCLR Sample: Upgrading Stored Procedures to Work with SQL Server 2005
This sample demonstrates how to leverage an existing extended stored procedure and how to use C++ for developing CLR code. It comprises two solutions:
CppXP2Clr, which contains two projects:
xp_cheksum, an extended stored procedure with C++ functions
clr_checksum, a port using CLR pure
CppUdt is a CLR safe SQL Server 2005 project that contains user-defined data type
This sample code is provided to illustrate a concept and should not be used in applications or Web sites, as it may not illustrate the safest coding practices. Microsoft assumes no liability for incidental or consequential damages should the sample code be used for purposes other than as intended.
To build the sample
On the Build menu, select the Build Solution menu item.
To run the sample
On the Debug menu, select the Start menu item.
This sample requires the AdventureWorks sample database on a SQL Server 2005 server. After you load a SQL Server Class Library application in the Visual Studio integrated development environment (IDE), a message box will prompt you to specify connection information to a SQL Server. For this sample application, specify the AdventureWorks database.
Use an existing extended stored procedure
Move existing stored procedure functions to SQL Server 2005
Use new user-defined data types in SQL Server 2005
How it Works
Yukon/CLR consists of two solutions, CppXP2Clr and CppUdt.
Solution CppXP2Clr consists of two projects, an extended stored procedure and a SQL Server Class Library project. The SQL/CLR project demonstrates the simplicity of moving native C++ function to SQL/CLR. The function checksum() will be used in both projects. The SQL/CLR project will be built using /clr:pure to leverage existing C++ functions.
Solution CppUdt is a SQL/CLR project built with /clr:safe and creates a user-defined data type (UDT). This project demonstrates using C++ to build SQL/CLR project with UDT.