The TSqlDialect
value sets the format of the date, time, date-time and boolean literals
in SQLExpression
and SQLValues,
and the escaping of string literals and LIKE patterns
(sqlMySQL doubles backslashes; sqlBDEParadox
and sqlAccess have no ESCAPE clause). Numeric
literals do not depend on the dialect.
The default dialect is sqlElevateDB. Set it once per
application with SetSQLDialect, give it
in each call to the full overload of ParseInput, or set TEgStrParser.SqlDialect.
| Identifier | Target database |
|---|---|
sqlMySQL |
MySQL 5.x+ / MariaDB 10.x+ |
sqlElevateDB |
ElevateDB 2.x+ |
sqlDBISAM |
DBISAM 4.x |
sqlPostgreSQL |
PostgreSQL 9.x+ |
sqlMSSQLServer |
Microsoft SQL Server 2008+ |
sqlSQLite |
SQLite 3.x+ |
sqlFirebird |
Firebird 3+ / InterBase |
sqlOracle |
Oracle 11g+ |
sqlAccess |
Microsoft Access (Jet / ACE) |
sqlBDEParadox |
BDE / Paradox |
| Dialect | Format | Example |
|---|---|---|
sqlMySQL |
DATE 'yyyy-mm-dd' |
DATE '2026-03-25' |
sqlElevateDB |
DATE 'yyyy-mm-dd' |
DATE '2026-03-25' |
sqlDBISAM |
'yyyy-mm-dd' |
'2026-03-25' |
sqlPostgreSQL |
DATE 'yyyy-mm-dd' |
DATE '2026-03-25' |
sqlMSSQLServer |
'yyyymmdd' |
'20260325' |
sqlSQLite |
'yyyy-mm-dd' |
'2026-03-25' |
sqlFirebird |
DATE 'yyyy-mm-dd' |
DATE '2026-03-25' |
sqlOracle |
TO_DATE('yyyy-mm-dd','YYYY-MM-DD') |
TO_DATE('2026-03-25','YYYY-MM-DD') |
sqlAccess |
#yyyy-mm-dd# |
#2026-03-25# |
sqlBDEParadox |
"dd.mm.yyyy" |
"25.03.2026" |
sqlMSSQLServer uses 'yyyymmdd' (and
'yyyy-mm-ddThh:mm:ss' for date-time values) because these
forms do not depend on the session language. DATETIME and
SMALLDATETIME read 'yyyy-mm-dd' as
year-day-month when the session language or SET DATEFORMAT
is day-first (Portuguese, French or German, for example). Changed in
2.1.0.
The fractional part is written only when the milliseconds are not zero.
| Dialect | No milliseconds | With milliseconds | Notes |
|---|---|---|---|
sqlMySQL |
TIME 'hh:mm:ss' |
TIME 'hh:mm:ss.fff' |
3-digit ms |
sqlElevateDB |
TIME 'hh:mm:ss' |
TIME 'hh:mm:ss.fff' |
3-digit ms |
sqlDBISAM |
'hh:mm:ss' |
'hh:mm:ss.fff' |
3-digit ms |
sqlPostgreSQL |
TIME 'hh:mm:ss' |
TIME 'hh:mm:ss.fff' |
3-digit ms |
sqlMSSQLServer |
'hh:mm:ss' |
'hh:mm:ss.fff' |
3-digit ms |
sqlSQLite |
'hh:mm:ss' |
'hh:mm:ss.fff' |
3-digit ms |
sqlFirebird |
TIME 'hh:mm:ss' |
TIME 'hh:mm:ss.ffff' |
4-digit ten-thousandths (ms x 10) |
sqlOracle |
TO_TIMESTAMP('hh:mm:ss','HH24:MI:SS') |
TO_TIMESTAMP('hh:mm:ss.fff','HH24:MI:SS.FF3') |
3-digit ms |
sqlAccess |
#hh:mm:ss# |
#hh:mm:ss# |
ms dropped |
sqlBDEParadox |
"hh:mm:ss" |
"hh:mm:ss" |
ms dropped |
Firebird: Firebird keeps sub-second time in
ten-thousandths of a second (0-9999). The parser multiplies the
milliseconds by 10: 500 ms is written
TIME '09:30:15.5000'.
The fractional part follows the rules of the time literals.
| Dialect | No milliseconds | With milliseconds | Notes |
|---|---|---|---|
sqlMySQL |
'yyyy-mm-dd hh:mm:ss' |
'yyyy-mm-dd hh:mm:ss.fff' |
3-digit ms |
sqlElevateDB |
TIMESTAMP 'yyyy-mm-dd hh:mm:ss' |
TIMESTAMP 'yyyy-mm-dd hh:mm:ss.fff' |
3-digit ms |
sqlDBISAM |
'yyyy-mm-dd hh:mm:ss' |
'yyyy-mm-dd hh:mm:ss.fff' |
3-digit ms |
sqlPostgreSQL |
TIMESTAMP 'yyyy-mm-dd hh:mm:ss' |
TIMESTAMP 'yyyy-mm-dd hh:mm:ss.fff' |
3-digit ms |
sqlMSSQLServer |
'yyyy-mm-ddThh:mm:ss' |
'yyyy-mm-ddThh:mm:ss.fff' |
3-digit ms; ISO 8601 with T |
sqlSQLite |
'yyyy-mm-dd hh:mm:ss' |
'yyyy-mm-dd hh:mm:ss.fff' |
3-digit ms |
sqlFirebird |
TIMESTAMP 'yyyy-mm-dd hh:mm:ss' |
TIMESTAMP 'yyyy-mm-dd hh:mm:ss.ffff' |
4-digit ten-thousandths (ms x 10) |
sqlOracle |
TO_TIMESTAMP('yyyy-mm-dd hh:mm:ss','YYYY-MM-DD HH24:MI:SS') |
TO_TIMESTAMP('yyyy-mm-dd hh:mm:ss.fff','YYYY-MM-DD HH24:MI:SS.FF3') |
3-digit ms |
sqlAccess |
#yyyy-mm-dd hh:mm:ss# |
#yyyy-mm-dd hh:mm:ss# |
ms dropped |
sqlBDEParadox |
"dd.mm.yyyy hh:mm:ss" |
"dd.mm.yyyy hh:mm:ss" |
ms dropped |
| Dialect | True | False |
|---|---|---|
sqlMySQL |
TRUE |
FALSE |
sqlElevateDB |
TRUE |
FALSE |
sqlDBISAM |
TRUE |
FALSE |
sqlPostgreSQL |
TRUE |
FALSE |
sqlMSSQLServer |
1 |
0 |
sqlSQLite |
1 |
0 |
sqlFirebird |
TRUE |
FALSE |
sqlOracle |
1 |
0 |
sqlAccess |
True |
False |
sqlBDEParadox |
TRUE |
FALSE |
Every itString token
is enclosed in single quotes, and single quotes inside it are
doubled.
sqlMySQL doubles backslashes as well, because MySQL and
MariaDB read \ as an escape character inside string
literals. Without it, an input such as \' OR 1=1 -- would
close the literal early (SQL injection). This assumes the server’s
default SQL mode; with NO_BACKSLASH_ESCAPES the doubled
backslashes would be compared literally. Changed in 2.1.0.
O'Brien -> 'O''Brien'
C:\temp -> 'C:\temp' (every dialect except sqlMySQL)
C:\temp -> 'C:\\temp' (sqlMySQL)
Integer, decimal and floating-point literals do not depend on the
dialect. The decimal separator is always ., whatever the
locale.
itDecimal: 1,99 -> 1.99
itFloat: 1,5 -> 1.5
The ESCAPE '\' clause of LIKE expressions is the same
for every dialect, with three exceptions: on sqlMySQL it is
written ESCAPE '\\' (a single backslash in that dialect’s
string literals), sqlBDEParadox gets no ESCAPE
clause, because the BDE SQL layer does not support it reliably, and
sqlAccess gets no ESCAPE clause either,
because Jet/ACE SQL does not support it: %, _
and [ are written as [%], [_] and
[[]. See Operators.