How do I get the output from the sql_query
?
import pyodbc
sql_query = "print 'Hello World'"
conn = pyodbc.connect("DRIVER={SQL Server};
SERVER=myserver;
DATABASE=mydatabase;
UID=myusername;
PWD=mypassword")
cur = conn.cursor()
cur.execute(sql_query)
cur.commit()
for row in cursor.fetchall():
print row
So far I think an SQL print is out of band from the usual structured responses?
http://www.easysoft.com/developer/languages/perl/sql_server_unix_tutorial.html#print_statement_status_messages has something similar to what I'm trying to do in Perl.
The closest I can see is the optional: http://www.python.org/dev/peps/pep-0249/#cursor-messages So I guess it's just not implemented?