[email protected] wrote:
Hello,
I am using Perl 5.10, FreeTDS 0.82, DBI 1.605 and DBD::ODBC 1.13 with an MS
SQL Server 2008.
An SQL table I am working with includes columns with the binary data type.
Whenever I try to prepare a statement with placeholders for these columns,
the prepare fails with this error:
DBD::ODBC::db prepare failed: [unixODBC][FreeTDS][SQL Server]Statement(s)
could not be prepared. (SQL-42000)
[unixODBC][FreeTDS][SQL Server]Implicit conversion from data type varchar to
binary is not allowed. Use the CONVERT function to run this query.
(SQL-22018)(DBD: st_prepare/SQLPrepare err=-1)
The DBD::ODBC documentation suggests that FreeTDS may not support
SQLDescribeParam and so a default parameter type is used for placeholders. I
have tried setting odbc_default_bind_type to SQL_BINARY but I still get the
above error.
I see that the prepare() method accepts a reference to a hash of attributes,
but when I tried to specify the TYPE attribute I still get the above error.
Is there a way to prepare statements with placeholders for binary datatypes
when using perl/DBI/FreeTDS ?
Thanks,
-Will
--
Will Saxon
Systems Administrator III
Sage
Healthcare Division
13545 Progress BLVD
Alachua, FL 32615
Tel: 386.418.7341
Fax: 813.207.9753
[email protected]
www.sagehealth.com
I am on holiday at present but will try to answer this properly when I'm
back in a week.
I have had this issue myself with FreeTDS (I think 0.82) and from memory
there is a test in DBD::ODBC which causes the same issue and it works
with other SQL Server drivers. As a result, my feeling at the time was
it was a freetds issue but I may revise when I'm back home.
Martin