I have a list of MS SQL CREATE scripts and I am trying to automate the process of executing each of these scripts. As this CREATE scripts does not result any records, I would want my automation script to return the SSMS output message that looks like: 'Command executed successfully'
Can I read this output message using pyodbc? Here is the sample code that I use to execute the script:
conn = pyodbc.connect(r'DRIVER={SQL Server};SERVER=%s;Trusted_Connection=True;'% (db_conn_string))
cursor = conn.cursor()
cursor.execute(query)