I have created a User Defined Table Valued Function in DB2 which takes in two parameters and returns a Table.
Calling the UDTVF from IBM i Access Client Solutions (Version: 1.1.7.1 Build: 7290) >> Run SQL Scripts works fine returning a table of results:
-- SELECT *
-- FROM TABLE(<library>.<udtvf>(<param. 1>,<Param. 2>)) AS ResultsTable
SELECT *
FROM TABLE(DPLIB06.FISMOSLSWAR(1,2017)) AS ResultsTable
I have an ODBC DSN defined that points to DB2. This DSN works fine as a Data Connection within MS Excel, Crystal Reports, etc. etc. and has, up to this point, worked fine even with some very complex queries.
When I attempt to add the above query to an Excel Sheet via the MS Query Editor I get the following warning/error messages:
SQL Query can't be represented graphically. Continue anyway?
No big deal with this warning: I always click OK and life goes on... but then I get
Could not add the table 'TABLE(DPLIB06.FISMOSLSWAR(1'.
So... Can someone give me the syntax for calling a DB2 User Defined Table Valued Function (with two parameters) from Microsoft Excel?