I am performing an insert query from Python (3.6) to SQL Server. I am trying to insert a bytes datatype into a varbinary(max)
column.
Now, the query executes successfully but value in the SQL Server column is not correct. Not sure what I am missing.
Is the data getting converted to some other format? How can this be rectified? Any pointers in the right direction will be appreciated.
Edit: In Python it's alphanumeric but when inserted into the sql server it is only numbers.
cn = pyodbc.connect()
cr = cn.cursor()
script=""" insert into table (Col1, col2) values (?,?)""" # Col1 is varbinary(max) column
VBM = VBM.encode('utf-8')#Bytes information corresponding to the varbinary(max) column
values = (VBM, FN)
cur.execute(Script, values)
cn.commit()
VBM in Python:
b'0x443611119900554616035D15220'
VBM when inserted into SQL Server:
0x307834353143313131313936303