IBM Database Add-Ins for Visual Studio  

Creating SQL and SPL Functions

The IBM® Database Add-Ins for Visual Studio simplify the process of creating functions written in SQL or SPL. You can use one of the following tools to create an IBM database function:

For a DB2 database In your IBM database project, you can create SQL scalar or table functions for DB2.

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

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

    The IBM Function Designer opens.

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

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

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

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

  4. Close the designer.

To create an SQL or SPL function by using the editor:

  1. In the Solution Explorer, right-click the Function folder under your IBM database project.
  2. Select Add, and then select Add New Item.

    The Add New Item window opens.

  3. In the Categories list, select the Functions folder.
  4. In the Templates list, select SQL Function.
  5. In the Name field, type a name for the new function file, then click OK.

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

  6. Use the editor to make appropriate changes for the function.
  7. To save your changes, select File, and then select Save [file name].

See Also

Developing IBM Database Functions | IBM Database Functions | Changing Function Properties | Managing Procedures, Functions, and Objects


.NET Development Forum   DB2 FAQs   IDS FAQs

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