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:
The IBM Function Designer, with which you can generate an SQL
or SPL function and save it to an IBM database that has a data
connection in the Server Explorer.
The Visual Studio Code Editor, with which you can manually
insert the SQL statement in the function script file in an IBM
database project in the Solution Explorer.
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:
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.
Use the views in the designer to define the function.
For detailed information about the fields in the designer
views, see
IBM Function Designer.
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.
Close the designer.
To create an SQL or SPL function by using the editor:
In the Solution Explorer, right-click the
Function folder under your IBM database project.
Select Add, and then select Add New Item.
The Add New Item window opens.
In the Categories list, select the Functions folder.
In the Templates list, select SQL Function.
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.
Use the editor to make appropriate changes for the function.
To save your changes, select File, and then select Save [file name].