You are here: Re: Access Query against SQL Server works only without criteria « MsSQL Server « IT news, forums, messages
Re: Access Query against SQL Server works only without criteria

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация