I have a script where I first read a table, saving an int
and a varbinary(512)
in form of a some_set = set()
, some_set.add((db_row['int_val'], db_row['varbin_val'))
. A set of tuples..
There may be multiple rows having the same int_val
/varbin_val
combination, but those are the duplicates.
Now saving them seems to work fine. But when I try to INSERT INTO
said saved rows, from the source table to the destination table, I get b"Incorrect syntax near '\\'
I assume this occurs, because the varbinary(512)
is not escaped correctly. (i currently just have a str()
wrapped around it.
How can I escape a varbinary(512)
from a MSSQL database, saved in a string tuple, to use it in a SELECT/INSERT WHERE
query?