Skip to main content

This article discusses how to define column names in a SQL statement that contain spaces and the words “OF” or “IN”.

Problem:

I am getting the ES0100 incorrect SQL statement syntax when a column name contains spaces and the word “OF” or “IN”. How is this resolved?

Resolution:

This is happening because there is a problem with the OpenESQL pre-processor when using column names with embedded spaces and reserved words which are surrounded by square brackets. The column name is flagged as an error. If the column name is enclosed within double quotes " " instead of square brackets [ ] then the error is not generated, for example:


EXEC SQL
DECLARE MYCUR CURSOR FOR
SELECT
[Item Num]
,[Completed Quantity]
,[Unit of Measure]
FROM
[TESTTAB]
WHERE
[Order Num] = :OrderNum
END-EXEC.
* 801-S*********** ( 0)**
** External Compiler Module message
** ES0100 Incorrect SQL statement syntax near of

The error is generated for the column [Unit of Measure]. This error has been fixed in Net Express 5.1 WrapPack (WebSync) 2.

Incident Number: 2219955

Old KB# 14379