I'm using pyodbc to connect to a .mdb file and do somethings.
sql = ("""\
DECLARE @i int = 1;
...somevalid sql...
""")
cursor.execute(sql)
The above gives me the error "Invalid SQL Statement; expected 'Delete',....
.
@i
is not used anywhere in the sql, and the sql below will run without the declare statement. I have seen in multiple places other people DO do this like here so it is supposed to be possible.