Help with syntax error

Results 1 to 3 of 3

Thread: Help with syntax error

  1. #1
    Reggie Guest

    Default Help with syntax error

    I am converting from Access to SQL and one of my statements is giving me an error and not executing. It is:<BR>OAI_query = "SELECT * FROM OAI WHERE current=&#039;OAI&#039; ORDER BY Focal"<BR>MyConn.Execute(OAI_query)<BR>The error I get is:<BR>Microsoft OLE DB Provider for SQL Server error &#039;80040e14&#039; <BR><BR>Line 1: Incorrect syntax near &#039;=&#039;. <BR><BR>/administration/projects/search.asp, line 53 <BR><BR>If I just execute the statement without the WHERE clause, it works fine. Is this different in SQL?<BR><BR>Thank you

  2. #2
    Join Date
    Dec 1969

    Default The sql looks fine but..

    ..check in the database table if the value of current is "OAI" or "oai" or "Oai", check for the case, also am not very sure whether "current" is a reserved word or not, may be make it like "mycurrent"<BR>--------------<BR>to check the case you can do this:<BR>"SELECT * FROM OAI WHERE ucase(mycurrent)=&#039;OAI&#039; ORDER BY Focal"<BR><BR>

  3. #3
    Reggie Guest

    Default Thank you!

    For whatever reason, current is a keyword. When I converted my Access Database to SQL, it put brackets (like [current]) around it so that it wouldn&#039;t be recognized as a keyword. I&#039;m not sure why that didn&#039;t work, but I changed it to "currentstatus" and it works now.

Posting Permissions

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