Escape table name in SQLite? Escape table name in SQLite? sqlite sqlite

Escape table name in SQLite?


You can escape table names with double quotes:

UPDATE "References" SET DateTimeLastEdited = datetime('now', 'localtime') WHERE NewsItemID = old.NewsItemID;

Depending on what you want to escape, you need to use different delimiters:

If you want to use a keyword as a name, you need to quote it. Thereare four ways of quoting keywords in SQLite:

'keyword' A keyword in single quotes is a string literal.

"keyword" A keyword in double-quotes is an identifier.

[keyword] Akeyword enclosed in square brackets is an identifier. This is notstandard SQL. This quoting mechanism is used by MS Access and SQLServer and is included in SQLite for compatibility.

`keyword` Akeyword enclosed in grave accents (ASCII code 96) is an identifier.This is not standard SQL. This quoting mechanism is used by MySQL andis included in SQLite for compatibility.

From SQLite documentation