Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2010
    Posts
    38

    Unanswered: Strange Syntax error

    Hi!

    When I do a "SELECT * ..." from a certain table, I get a normal result with rows and column headers. One column header reads "Resource", but when I do a "SELECT Resource FROM ..." I get Syntax error in SQL statement at or about "Resource FROM PUB.ActOper WHERE CreDate " (10713). It's a Progress database.

    What could be the problem? Thanks!

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by tosa View Post
    What could be the problem?
    my money is on RESOURCE being a reserved word
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2010
    Posts
    38
    Yes, that was it. How silly of me. Thank you. But when you solve one problem, along comes the next. According to the Progress SQL reference "you can use keywords as identifiers in SQL statements only if you delimit them with double quotation marks".

    But I can't find the right syntax to use in my ASP.NET page. Double and single quotation marks are not interchangeable it seems. This will not work: Dim comm As New OdbcCommand('SELECT "Resource" FROM PUB.Table', conn)

    Does anyone know the correct way to write this sentence?

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    You did not post the error message that you received (I don't believe "This will not work" is a valid error message in Progress).

    For future posts please remember: "does not work" will not get you any help. Post the exact error message that the DBMS (not your programming language!) gives you. Use Copy & Paste for that


    So my wild guess is:

    Normally column (and table) names are stored in uppercase in the database, which doesn't matter because SQL is case-insensitive.

    When you use double quotes around an identifier, you are requesting to handle it in a case-sensitive manner ("Resource" being a different column than "RESOURCE").

    So I would guess you will need to use

    SELECT "RESOURCE" FROM PUB.Table

  5. #5
    Join Date
    Feb 2010
    Posts
    38
    Ok, sorry for not being clear enough.

    The exact name of the column is Resource.

    Case 1:
    Dim comm As New OdbcCommand("SELECT Resource FROM PUB.ActOper WHERE CreDate > TO_DATE ('05/24/2010')", conn)

    ERROR [HY000] [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Syntax error in SQL statement at or about "Resource FROM PUB.ActOper WHERE CreDate " (10713)

    Case 2:
    If I try some other combination of single and double quotes I get a compilation error saying "valid continuation expected" or "expression expected".

  6. #6
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    The first step in debugging problems like this, is to run the statement outside of your programming language (using the SQL interface of your DBMS) to make sure the SQL is correct.

    Plese verify first that the syntax of your statement is correct outside of your code before you run it from within your code.

    ERROR [HY000] [DataDirect][ODBC Progress OpenEdge Wire Protocol driver][OPENEDGE]Syntax error in SQL statement at or about "Resource FROM PUB.ActOper WHERE CreDate " (10713)
    I have no idea about BASIC but to me this sounds like you don't have the quoting right, which makes it a programming language problem - not a SQL or DBMS problem.

Posting Permissions

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