Skip to Content.
Sympa Menu

freetds - Re: [freetds] issue with prepared statement queries from a Mac OS X client to SQL Server 2005

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT freetds.org>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] issue with prepared statement queries from a Mac OS X client to SQL Server 2005
  • Date: Mon, 13 Oct 2008 14:46:14 -0400

Nick Davis wrote:
>
> I'm using FreeTDS 0.82 on a Mac OS X Leopard machine to run some
> prepared statements against our SQL Server 2005 database. The query
> with the issue is:
>
> SELECT COUNT(*) from tbl WHERE tbl_id = ?
>
> Whenever I run the application, I receive the following error with the
> query:
>
> SQLSTATE = 420000
> Native Error Code = 402
> [FreeTDS][SQL Server]The data types varchar and text are incompatible in
>
> the equal to operator.
>
> However, tbl_id is of type VARCHAR(36) in the database, not TEXT.
>
> I've attached a relevant section of the freetds dump file that may help

Please post more of the log file, at least the last 1000 lines and the
first 100. The part you posted was the server's error message (hey, I
believed you!) but what I'm interested in is how the query and parameter
data are sent to the server.

IIRC there's some gnarly code in the driver to divine the parameter
datatype. It might get yours wrong.

--jkl




Archive powered by MHonArc 2.6.24.

Top of Page