A list of SQL reserved words for InterSystems IRIS® data platform.
Description
Within SQL certain words are reserved. You cannot use an SQL reserved word as an SQL identifier (such as the name for a table, a column, an AS alias, or other entity), unless:
-
The word is delimited with double quotes ("word"), and
-
Delimited identifiers are supported. For further details, refer to the Identifiers.
This list contains only those words that are reserved in this sense; it does not contain all SQL keywords. Several of the words listed above start with the "%" character, indicating that they are InterSystems SQL proprietary extension keywords. In general, it is not recommended to use words that begin with "%" as identifiers such as table and column names, because new InterSystems SQL extension keywords may be added in the future.
You can check if a word is an SQL reserved word by invoking the IsReservedWord()Opens in a new tab method, as shown in the following example. Specify the reserved word as a quoted string; reserved words are not case-sensitive. $SYSTEM.SQL.IsReservedWord() returns a boolean value.
WRITE !,"Reserved?: ",$SYSTEM.SQL.IsReservedWord("VARCHAR")
WRITE !,"Reserved?: ",$SYSTEM.SQL.IsReservedWord("varchar")
WRITE !,"Reserved?: ",$SYSTEM.SQL.IsReservedWord("VarChar")
WRITE !,"Reserved?: ",$SYSTEM.SQL.IsReservedWord("FRED")
This method can also be called as a stored procedure from ODBC or JDBC: %SYSTEM.SQL_IsReservedWord("nnnn").