0

As part of my records which come back from a Python fdb SQL select query, I get a b"string". I pass it on to SQL Server and execute a call to be stored into a sql_variant column in a SQL Server database.

However I get this error:

pyodbc.Error: ('HYC00', '[HYC00] [Microsoft][ODBC SQL Server Driver]Optional feature not implemented (0) (SQLBindParameter)')

Here is the firebird field spec that the b"string" comes out of using fdb.

DATA BLOB segment 80, subtype BINARY Nullable

I even tried converting the b"string" to a bytearray using:

pyodbc.Binary(b_string)

Still get the same error. :(

Is there anyway I can get more info on the error. Maybe turn on more logging somewhere? I am using SQL Server Express locally on Windows.

By process of elimination I figured out it was the DATA field which was causing this error, since when I pass in NULL instead to the SQL Server execute call the error goes away.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Dan
  • 2,209
  • 3
  • 23
  • 44
  • 3
    Shouldn't you be using `varbinary(max)` instead of `variant`? Sounds a lot like [Inserting pyodbc.Binary data (BLOB) into SQL Server image column](https://stackoverflow.com/questions/11836924/inserting-pyodbc-binary-data-blob-into-sql-server-image-column) - but don't use the `image` type since that's been deprecated since at least SQL Server 2005. – AlwaysLearning Aug 29 '20 at 00:44
  • The error indicates the ODBC SQL Server driver doesn't implement a feature necessary to do what you want, so the problem isn't with the `DATA` field itself. However, like AlwaysLearning says, shouldn't you be using `varbinary(max)` (which is probably the closest equivalent of a Firebird `blob sub_type binary`)? – Mark Rotteveel Aug 29 '20 at 08:25
  • I tried both approaches, changing the destination sql server column data type to varbinary. It didn't work with or without passing the data through pyodbc.Binary. Is there anyway to figure out from some sort of log which feature the driver is talking about? – Dan Sep 01 '20 at 19:42

0 Answers0