Python - format single quote in SQL statement PyODBC
问题 I already tried a couple of drivers: pymsql, pyobdc and still have issue with format single quote in SQL. Examples of code below: CASE 1. import pyodbc UPDATE_SQL3 = """ UPDATE STATION SET STATION_NAME = ?, STATION_TITLE = ?, ACTIVE = ? WHERE STATION_ID = ? """ conn = pyodbc.connect('DRIVER={SQL Server};SERVER=local;DATABASE=DB;UID=me;PWD=pass') cursor = conn.cursor() cursor.execute(UPDATE_SQL3 % (name, title, active, id )) This code doesn't compile: "not all arguments converted during string