Output converter for converting DECIMAL('100.000') in pyodbc

Viewed 152

I have numeric column in one of the SQL Server tables. When I tried retrieving the data from this table, the numeric value of 100.00 has been taken in Python as DECIMAL (100.000) which is preventing me in passing this value as parameter to one of the stored procedures.

This is the bytecode I am getting for 100.000: b'\x13\x05\x01\x00\xe8vH\x17\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'

When I find length of this bytecode it is 19.

def decimal_converter(raw_bytes):
    struct.unpack(?, raw_bytes)
     return

cn.add_output_converter(pyodbc.SQL_DECIMAL, decimal_converter)

Any help in unpacking this bytecode would be greatly appreciated. Thanks

0 Answers
Related