The process of effectively using the
Enterprise Developer SQL CLR integration feature to create or add user-defined functions and types, aggregates, and triggers in managed code, and access stored procedures, is as follows:
- If using one or more stored procedures, determine the type of data type parameters you want to use (COBOL or .NET) and make any necessary adjustments. See
Data Type Parameters in COBOL and SQL CLR Stored Procedures for details.
- Launch
Enterprise Developer.
Important: On UAC-enabled operating systems, you must start
Enterprise Developer as an administrator.
- Create a Visual Studio solution using the
SQL Server Database Project template, which includes two projects in the solution – a COBOL managed Class Library project for your COBOL stored procedure code, and a .Publish project.
For more information, see
SQL Server Database Project Template.
- Optionally add one or more additional COBOL managed or native projects to the solution. See
Working with Multiple COBOL Managed Projects for details.
- Set the properties for each COBOL managed project in the solution:
- If you are using SQL Server 2008 R2, specify
.NET Framework 3.5 or earlier; for later versions of SQL Server, specify .NET ???.
- If you intend to code new SQL CLR objects or add existing SQL CLR objects that use EXEC SQL statements, set the project properties to use the
OpenESQL
ESQL Preprocessor, and add the
DBMAN compiler directive set to the value of
ADO.
- Do either or both of the following:
- Build the project to generate a DLL module that can be accessed from a COBOL application.
- Under the
.Publish project, expand
References and verify that all COBOL managed projects in the solution that contain stored procedures are referenced. If not, create a reference for each. See
To add a project reference to a .Publish project for instructions.
- Right-click the
.Publish project; then select Publish from the context menu.
This deploys your stored procedure code to your SQL Server instance and creates an object in the SQL Server database to use the generated DLL module.
- Execute the SQL CLR object, providing input values as necessary, so you can see the output it generates.
At this point, your SQL CLR object is available to any COBOL application by calling the object using the following EXEC SQL statement in your COBOL code:
EXEC SQL :spReturnCode = call "objectName" args
We recommend that you complete the OpenESQL tutorials that take you through the process of creating and calling a SQL CLR stored procedure. These are available from the
Tutorials: SQL CLR Integration topic.