[ACCEPTED]-Access second result set of stored procedure with SQL or other work-around? Python\pyodbc-pyodbc

Accepted answer
Score: 19

No need for anything fancy. Just use nextset:


import pyodbc

db = pyodbc.connect ("")
q = db.cursor ()
q.execute ("""
SELECT TOP 5 * FROM INFORMATION_SCHEMA.TABLES
SELECT TOP 10 * FROM INFORMATION_SCHEMA.COLUMNS
""")
tables = q.fetchall ()
q.nextset ()
columns = q.fetchall ()

assert len (tables) == 5
assert len (columns) == 10

0

Score: 0

There are a few possible methods here. If the 3 result sets are all the same, you might 2 be able to use the INSERT...EXEC method. Otherwise 1 OPENQUERY might work.

More Related questions