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

"James K. Lowden" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.