0
Good evening.
Staff made the connection to the database and I need to compare two tables tab1 and tab2 so that the external "for" fixes the first line of "tab1" in the zero column and "for" internal traverse all rows of column one of tab2 so on until comparing the last row of tab1 with the last tab2 tried to mount here, but not this correct could anyone help? Thank you.
import pyodbc
conn = pyodbc.connect("DRIVER={SQL Server};Server=localhost;database=teste;uid=;pwd=")
cursor = conn.cursor()
cursor.execute('select * from tab1')
cursor.execute('select * from tab2')
for row in cursor.fetchall():
print (row[0])
for row in cursor.fetchall():
print (row[1])
Ola Leandro, good afternoon. This code returns the error: Error: ('HY000', '[HY000] [Microsoft][ODBC SQL Server Driver]Busy connection with the results of another HSTMT (0) (Sqlexecdirectw)') - is passing two cursors on the same connection.
– aguch