19 The XML Driver : SQL Support

SQL Support
This section provides information about the SQL statements that the XML driver processes, and about SQL standards and conventions that the driver supports:
SQL Statements
The SQL Engine included with the XML driver supports the following SQL statements:
NOTE: See the table at the beginning of this chapter for the SQL statements that the XML driver supports for the different types of supported file formats.
Extensions to SQL Standards
The XML driver uses SQL grammar that is compliant with entry level ANSI SQL-92. Table 19-7 summarizes significant extensions to the grammar.
Table 19-7. SQL Extensions 
Grammar Token Definitions
The tokens used in the XML driver SQL grammar are defined in the following sections:
Regular Identifiers
A regular identifier must begin with a letter and may not exceed 128 characters. In addition, all ASCII characters are converted to uppercase.
The following are examples of regular identifiers:
Delimited Identifiers
Delimited identifiers may not exceed 128 characters. A double quotation character can be embedded within the string by specifying two consecutive double quotation mark characters. A delimited identifier can span multiple lines. The body of a delimited identifier can contain any character except the newline character.
The following examples show delimited identifiers:
Integer Numbers
Examples of integer numbers are:
Real Numbers
Examples of real numbers are:
Character String Literals
Character string literals are delimited with single quotation mark characters. A single quotation mark character can be embedded within the string by specifying two consecutive single quotation mark characters. A character string literal can span multiple lines.
Examples are:
GUID Literals
A GUID uses the following format, where x is a hexadecimal digit:
xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
Hex Literals
Hex literal values are introduced with an uppercase X followed by a single quoted string of hexadecimal characters.
Examples are:
Time and Date Literals
Date, time, and timestamp literals are date, time, and timestamp values surrounded by a standard prefix and suffix. Date literals are specified in a YYYY-MM-DD format. Time literals are specified in an HH:MM:SS format with an optional fraction component. Timestamp literals are a concatenation of date and time values.
Examples for ODBC and SQL syntax are shown in the following table.
{ts ’1999-09-19 11:11:11.225’}
NOTE: ODBC 1.x style ODBC escape sequences such as the following are not supported:
--(*VENDOR(Microsoft), PRODUCT(ODBC) ...*)--
SQL Operators and Symbols
Keywords for the XML Driver
A keyword may not be used as a regular identifier. For example, the following statement would generate a syntax error because INDICATOR is a keyword:
SELECT INDICATOR FROM T1
You can, however, enclose a keyword in double quotation marks to form a delimited identifier. For example, the following statement is valid:
SELECT "INDICATOR" FROM T1
Table 19-10 lists all of the keywords that are reserved for use in SQL statements or designated as potential future reserved words.
Table 19-10. Reserved Keywords 
SQL Comments
ANSI SQL-92 standard comments (--) and C++ standard comments (/*...*/, //) are supported. Comments can be nested.
For example, in the following query columns col2, col3, and col4 are ignored:
SELECT col1  /* col1 comment */
/*
    col2, -- col2 comment
    col3, // col3 comment
    col4, /* col4 comment */
*/
FROM t1