|
Posted by Erland Sommarskog on 06/23/06 21:26
ShastriX (shastrix@gmail.com) writes:
> However, when I try to get the records where the SessionOff equals 0, I
> get the following error:
> ~~~~~
> ODBC--call failed. [Microsoft][SQL Native Client][SQL server]
> Incorrect syntax near the keyword 'NOT'. (#156)
> ~~~~~
>
> I checked the SQL of the Access query, but there's no NOT anywhere in
> it:
> ~~~~~
> SELECT tblWorkDateAttendance.*
> FROM tblWorkDate INNER JOIN tblWorkDateAttendance ON
> tblWorkDate.WorkDate = tblWorkDateAttendance.WorkDate
> WHERE (((([ForenoonFlag] And [AfternoonFlag]))=0) AND
> ((tblWorkDateAttendance.WorkDate)<Date()) AND
> ((Year([tblWorkDate].[WorkDate]))=Year(Date())) AND
> ((Weekday([tblWorkDate].[WorkDate])) Between 2 And 6) AND
> ((tblWorkDate.HolidayFlag)=False));
> ~~~~~
Then again, this query does not run on SQL Server. (There is no
date() function in SQL Server and "= False" would yield an error
about missing column.
Presumably some transformation occurs along the way. You could use
the Profiler to see what is actually sent to SQL Server.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|