Question about FreeTDS, DBD::ODBC and bind parameters with prepar ed statements
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
Hello, I emailed dbi-users with this question and the author of DBD::ODBC suggested this may be a FreeTDS issue. I am using Perl 5.10, FreeTDS 0.82, DBI 1.605 and DBD::ODBC 1.13 against an MS SQL Server 2008 machine. If I try to prepare a statement containing placeholders for fields with a binary datatype, I get the following 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 documentation for DBD::ODBC suggests that this can happen if the driver does not support SQLDescribeParam. In these cases a default parameter type of SQL_VARCHAR is used. I've tried changing the default parameter type to SQL_BINARY, but I still receive the above error when trying to prepare a statement. I've also looked for a way to specify the parameter type at the time I prepare the statement, but there doesn't appear to be a way to do this (specifying the TYPE attribute in the prepare statement has no effect). Is this supposed to work, i.e. am I just 'doing it wrong'? As far as I know the only way to get placeholder support in prepared statements with FreeTDS and DBI is DBD::ODBC, is that correct? Thanks for any assistance. -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