Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Cold Fusion and Query error returned by SQL Server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-11-19 : 23:06:02
Jo writes "Here's the error that shows up.

ODBC Error Code = 37000 (Syntax error or access violation)
[MERANT][ODBC SQL Server Driver][SQL Server]Invalid operator for data type. Operator equals boolean AND, type equals varchar.

SQL = "SELECT a1.fname & ' ' & a1.lname AS Expr1, a2.fname & ' ' & a2.lname AS Expr2, a2.ath_ID, photo.image_ID, photo.ath_ID, photo.descr, photo.thumb, photo.large
FROM (athlete AS a1 INNER JOIN athlete AS a2 ON a1.ath_ID = a2.partner) LEFT JOIN photo ON a2.ath_ID = photo.ath_ID
WHERE (((a1.hof)=1) AND ((a1.disc)=3 Or (a1.disc)=4))
ORDER BY a1.lname, photo.image_ID;"


It runs fine on my system with Access and PWS, when I upsize it and try to run it off the SQL Server I get the above error. Other queries to the same database function correctly so I know it's not a connectivity thing. I'm wondering if/why the AND generates that error. The datatypes in the AND part of the query are all numbers.
hof type 1 or 0
ath_id type number
disc type 1... 7
partner type number....
Text elements are fname, lname, descr, thumb(xyz.jpg) and large (xyz.jpg).

Hope that's enough info, thanks. SQL newbie."
   

- Advertisement -