Absent Member.
Absent Member.
1887 views

Incorrect SQL statement

Jump to solution

I am getting a "COBES0100 : Incorrect SQL statement syntax near: RESULT" when I try  building my project. RESULT is a column name in one of my tables. This code is coming over from Acucobol, where It compiles and runs with no problem. According to the documentation the COBES0100 error may come if the SQL directive BEHAVIOR is set to MAINFRAME, but I have it set to ANSI. I am getting it as well for column name DATASET and APPLICATION. Am I doing something wrong or will I have to change the Column name in the SQL Server database?

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Put the column name in quotes like "RESULT" in the query or use a table alias with it like:

    EXEC SQL
       SELECT
             A.result
       INTO
             :mfcustomers-result:mfcustomers-result-NULL
         FROM mfcustomers A
        WHERE (A.cust_no = :mfcustomers-cust-no)
      END-EXEC

View solution in original post

0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

Put the column name in quotes like "RESULT" in the query or use a table alias with it like:

    EXEC SQL
       SELECT
             A.result
       INTO
             :mfcustomers-result:mfcustomers-result-NULL
         FROM mfcustomers A
        WHERE (A.cust_no = :mfcustomers-cust-no)
      END-EXEC

View solution in original post

0 Likes
Absent Member.
Absent Member.

Thanks Chris

That worked and thanks for the quick response.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.