[freetds] error for insert into varbinary column: Implicit conversion from data type varchar to varbinary is not allowed
freddy77 at gmail.com
Fri Feb 26 09:30:05 EST 2010
2010/2/25 Hari Krishna Dara <haridara at gmail.com>:
> On Thu, Feb 25, 2010 at 10:20 AM, <freetds-request at lists.ibiblio.org> wrote:
>> Message: 2
>> Date: Wed, 24 Feb 2010 21:24:47 -0500
>> From: "James K. Lowden" <jklowden at freetds.org>
>> Subject: Re: [freetds] error for insert into varbinary column:
>> Implicit conversion from data type varchar to varbinary is not
>> To: FreeTDS Development Group <freetds at lists.ibiblio.org>
>> Message-ID: <20100224212447.7cbcd9eb.jklowden at freetds.org>
>> Content-Type: text/plain; charset=ISO-8859-1
>> Hari Krishna Dara wrote:
>> > I am trying to insert data into a varbinary column from python via
>> > pyodbc and unixODBC and get the below error:
>> > Traceback (most recent call last):
>> > ??File "test_pyodbc.py", line 36, in <module>
>> > ?? ?cur.execute(sql, (pyodbc.Binary(data),))
>> > pyodbc.DataError: ('22018', ' [FreeTDS][SQL Server]Implicit
>> > conversion from data type varchar to varbinary is not allowed. Use the
>> > CONVERT function to run this query. (257) (SQLPrepare)')
>> > The error occurs no matter what the data contains and how long it is
>> > (happens with empty data also).
>> Designed behavior. Binary != text.
> Since I am using pyodbc.Buffer (which itself is mapped to python's built-in
> buffer type), this is not text. If somewhere in the stack, it is being
> treated as text, then it is a bug.
> -- Hari
To narrow down the problem a DM log would help. If program bind
pyodbc.Binary type to text this is a problem in pyodbc.
More information about the FreeTDS