IBM Database Add-Ins for Visual Studio  

Creating Procedures, Functions, and Objects with Scripts

You can create a DB2 SQL or IDS SPL procedure or function, or an IBM database table or view by specifying and running its DDL script in the IBM Script Designer.

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 an IDS database Creating overloaded procedures that are based on data type produces undefined results.

To create a DB2 SQL or IDS SPL procedure or function, or an IBM database table or view by using a script:

  1. In the Server Explorer, right-click your IBM data connection node, and then select New Script on the shortcut menu.

    The IBM Script Designer opens.

  2. In the Script section of the designer, enter the SQL or SPL code to create the DDL script. You can enter the code by using one or more of the following actions:
    • Type the SQL or SPL code.
    • Copy the SQL or SPL code from an existing script and paste the code in the section.
    • For a DB2 database Insert a code fragment by using the shortcut menu. Right-click in the section, select Insert SQL on the shortcut menu, and then select a command on the submenu.

      You can insert one of the following code fragments: CREATE TABLE or CREATE VIEW.

      For a DB2 database You also can insert one of the following code fragments: IF, CASE, LOOP, REPEAT, WHILE, CURSOR, FOR, CREATE PROCEDURE, or CREATE FUNCTION (scalar and table).

  3. Run the script. From the IBM Script Designer menu, select Execute Script.

    The IBM Output Message Pane displays the status messages as the script runs. If your script runs successfully, the DB2 SQL or IDS SPL routine or IBM database object is created in the database.

  4. Close the designer.

    You cannot save a script. You must run the script to create the routine or object.



See Also

IBM Script Designer | Managing Procedures, Functions, and Objects


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

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