[freetds] FreeTDS and MSSQL
James K. Lowden
jklowden at freetds.org
Sun Apr 20 14:37:14 EDT 2008
Venkat Lak wrote:
> I use FreeTDS 0.63 to access a MSSQL server 2000 (version
> 8.00.2039). It connects fine and my queries work except for
> one - when I use a GUID string (a varchar column) in the
> where clause it fails:
>
> select * from table where
> tid='bb8c5fe8-5e25-4181-8c3f-9ed12b6f9eb7-ed';
>
> However, when I do:
>
> select * from table where
> tid>='bb8c5fe8-5e25-4181-8c3f-9ed12b6f9eb7-ed';
>
> it works ! It also works for '>','<','<=' and '<>' comparison
> operators - just that '=' fails. In the tds dump I get:
>
> dblib.c:4297:dbsqlok(010B7BC0)
> net.c:363:error: select(2) returned 0x2726, "Unknown error"
> util.c:328:tdserror(010B7A08, 010B8340, 20004, 10022)
> dblib.c:7583:dbperror(010B7BC0, 20004, 0)
Um, no. tdserror() was introduced in January 2007, long after 0.63 was
released.
FreeTDS doesn't interpret SQL. The server is rejecting it, and it's very
likely that it returns a message before it closes the connection. Look
for an error token in the TDSDUMP log:
$ grep marker dump | grep ERROR
token.c:525:processing result tokens. marker is aa(ERROR)
token.c:105:tds_process_default_tokens() marker is aa(ERROR)
The message text will be nearby.
HTH.
--jkl
More information about the FreeTDS
mailing list