SQL Statement Syntax
This topic summarizes the rules for using SQL statements.
SQL Naming Conventions
Table names and field names must contain a leading alphanumeric character. The following table shows the SQL naming conventions used in ADO for Windows CE.
Convention |
Field and index names |
Table names |
Character length of name |
Between 1 and 64 characters |
Between 1 and 31 characters |
Alphanumeric |
Yes |
Yes |
Control characters (ASCII values 0 through 31) |
No |
No |
Disallowed characters in name |
`. ! ’ [ ] " * ? |
`. ! ’ [ ] " * ? |
Explicitly allowed characters |
None |
_ - + = , ; @ # $ |
Leading or trailing white space or periods |
No |
No |
Interior spaces |
Yes |
Yes |
Interior periods |
No |
No |
Statement Form
- A SQL statement can end in a trailing semicolon, which is ignored.
- A SQL statement can be no longer than 2,048 characters.
- Statements are case sensitive when assigning data to a field.
- SQL statements are locale-independent and always in English. Dates are interpreted according to the current user’s locale. Use the yyyy/mm/dd format to provide generic locale-independent dates.
String Use
- Quotation marks around object names are required when names contain elements other than alphanumeric characters or the underscore character.
- You can enclose strings with double or single quotation marks. There is no escape mechanism for actual quotation marks within strings. You can use square brackets to enclose object names but not strings.
- An empty SQL string generates the DB_E_NOCOMMAND error value.
- Quotation marks must be used to enclose table or field names that are not alphanumeric text. The exception is the underscore character, which can be used without enclosing quotation marks.
White Space
- White space consists of the space, tab, new line, and line feed characters.
- Runs of white space are treated as a single white-space character in all cases except within strings enclosed by quotation marks.
Other Rules And Limits Of ADO CE
- Constant literals are limited by memory.
- Tables are limited to 255 columns.
- Query results are limited to 64 KB.
- Table and procedure names are limited to 31 characters.
- Field names can be up to 64 characters.
- Up to three fields can be sorted in an ORDER BY clause.