mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.88k stars 561 forks source link

Executing multiple queries #1347

Closed cloud-rocket closed 2 months ago

cloud-rocket commented 2 months ago

Environment

Issue

Because Aspen IP21 is not fully compliant with MSSQL, there is no way to limit the amount of results without running 2 queries together:

SET MAX_ROWS 100;
SELECT SELECT NAME, TS, VALUE from HISTORY where NAME='abc';

Seems like cursor.execute only runs the 1st query, but not the second.

expected behavior: Return 100 rows as it happens in Aspen SQLPlus observed behavior: Error returned

v-chojas commented 2 months ago

Did you try cursor.nextset() ?