IBM Database Add-Ins for Visual Studio  

Creating SQL and SPL Procedures

The IBM® Database Add-Ins for Visual Studio simplify the process of creating and testing procedures. You can use one of the following tools to create an SQL or SPL procedure:

With the designer, you name the procedure, define the structure, and specify the parameters and additional options. You also can customize the generated source code by specifying files that contain specific code fragments.

Important: If you use Visual Studio 2008, do not create stored procedures with names that are longer than 39 characters. Stored procedures with names that are longer than 39 characters can cause errors when you use the Visual Studio 2008 debugger and other components.

For a DB2 database For SQL procedures, you can specify and include the following code fragments: header, variables declaration, exception handlers, and statements that precede the END statement.

With the designer, you also can specify access privileges for the procedure.

For an IDS database Creating overloaded procedures that are based on data type produces undefined results.

To create an SQL or SPL procedure by using the designer:

  1. In the Server Explorer, right-click Procedures under your data connection, and then select Add New SQL Procedure with Designer on the shortcut menu.

    The IBM Procedure Designer opens.

  2. Use the views in the designer to define the procedure.

    For detailed information about the fields in the designer views, see IBM Procedure Designer.

  3. Save the procedure definition. From the File menu, select Save [procedure name].

    The procedure definition script is run against the database and the procedure is created.

  4. Close the designer.

To create an SQL or SOL procedure by using the editor:

  1. In the Solution Explorer, right-click the Procedures folder under your IBM database project, select Add, and then select New Item on the shortcut menu.

    The Add New Item window opens.

  2. In the Categories list, select the Procedures folder.
  3. In the Templates list, select SQL Procedure.
  4. In the Name field, type a name for the new procedure file, and then click Add.

    A new procedure file with a basic structure is created and added to your project.

  5. Use the editor to make changes to the procedure.
  6. To save your changes, perform one of the following actions:
    • To save the procedure with its default file name, from the File menu, select Save [file name].
    • To save the procedure with another name, from the File menu, select Save [file name] As, type a new name for the procedure file in the Save File As window, and then click Save.

See Also

Developing IBM Database SQL and SPL Procedures | DB2 SQL Procedures | IDS SPL Procedures | Changing SQL and SPL Procedure Properties | Managing Procedures, Functions, and Objects


.NET Development Forum   developerWorks: Visual Studio .NET   DB2 FAQs   IDS FAQs

© Copyright IBM Corporation 2002, 2019. All Rights Reserved.