How to execute an .sql file in pymssql
问题 I'm trying to execute an sql file in python using pymssql, this file contains a BEGIN TRANSACTION, a COMMIT TRANSACTION and an END, and some safety nets before and after. I'm trying to open the file in memory and execute the content: file = open(options.sqlFile, 'r') sqlFileContents = file.read() file.close() cursor.execute(sqlFileContents) conn.commit() But it's returning me errors: pymssql.ProgrammingError: (102, "Incorrect syntax near 'GO'.DB-Lib error message 102, severity 15:\nGeneral