IBM Database Add-Ins for Visual Studio  

Creating OLE DB Table Functions  (DB2)

With the IBM® Database Add-Ins for Visual Studio, you can define OLE DB table functions that access OLE DB data sources and extract data from them. You can use the IBM OLE DB Table Function Designer to create an OLE DB table function. With the designer, you can optionally create a DB2 table that contains the OLE DB table function data, and a DB2 view for the table function.

Prerequisite: The IBM OLE DB Table Function Designer uses table functions that are provided by the DB2 database engine. Before you create your first OLE DB table function, you must enable the use of these functions.

To create an OLE DB table function:

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

    The IBM OLE DB Table Function Designer opens.

  2. Use the views in the designer to define the table function, and optionally to indicate that you want to create a DB2 table or a DB2 view of the table function, or both.

    Note: You must specify information for fields that are in the Table Function view and the Function Data view.

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

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

    The table function definition script is run and the table function is created in the database.

  4. Close the designer.

The table function is shown in the Functions folder of your DB2 data connection in the Server Explorer. If you selected the option to create a DB2 table from the OLE DB data, the table is created and is shown in the Tables folder of your data connection. If you selected the option to create a DB2 view for the table function, the view is created and is shown in the Views folder of your data connection.

You can run an OLE DB table function in the same way that you run a DB2 SQL function.


See Also

Developing OLE DB Table Functions | OLE DB Table Functions | Running Procedures or Functions


.NET Development Forum   DB2 FAQs

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