Search code examples
user-defined-functionsoledbcommon-table-expressionado

In-line Table Value Function with Recursive CTE using ADO with OLE DB


Apologies, I cannot provide a reduced data case for the moment. But here is a general question.

I have been using, since SQL Server 2005, thru an application using ADO with OLE DB, a Multi-Statements Table Value Function with Recursive CTE without problems. With SQL Server 2019 performance became a problem. I then re-wrote the function as In-line Table Value Function and regain performance and functionality when used in SQL Server Management Studio. When using in the application the first execution of a simple query with this In-line TVF returns an empty or closed recordset. got asserts in atldbicli.h. Subsequent executions of the same query return proper recordset. When I replace the select statement on the CTE by a static select statement of values, the recordset is being populated.

Any clue? axis of research , proposals? Thanks in Advance.


Solution

  • It appears we were using an outdated version of ADO.