Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder CurtWRC's Avatar
    Join Date
    May 2005
    Location
    UK
    Posts
    224
    Thanks
    9
    Thanked 1 Time in 1 Post

    Line 1: Incorrect syntax near....

    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:

    Code:
    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.

  • #2
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    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.

  • #3
    Regular Coder CurtWRC's Avatar
    Join Date
    May 2005
    Location
    UK
    Posts
    224
    Thanks
    9
    Thanked 1 Time in 1 Post
    Thanks for your help. It works great.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •