View Full Version : Line 1: Incorrect syntax near....

06-11-2007, 02:52 PM
I am currently in the process of migrating my website from an MS Access database to an MS SQL database. All seems to be going fine apart from I'm having the following error appear on a few pages:

Line 1: Incorrect syntax near '1'

The '1' varies and Ive seen it as a '#', '*' and others.

After removing some of the code Ive got it to work on one page by removing the following from a SQL statement:

WHERE Lastlogin > #" + dtmDatePast + "#

It seems like all the errors I'm getting are related to dates, specifically in WHERE clauses.

Has anyone experienced this problem before and/or knows a solution?

Thank you.

06-11-2007, 06:34 PM
In access you have to add the # signs around the dates. In MSSQL single quotes is what you want.

where date = 'some date here'

Good luck.

06-11-2007, 09:15 PM
Thanks for your help. It works great.