SQL and XML are important standards. Each allows tremendous flexibility in storage of data. This document is an attempt to define a naming convention to facilitate the interchange of data primarily between SQL and XML, but also with regard to other interchange standards.
SQL and XML support Unicode for both element data as well as field and table names for SQL and element and attribute names for XML. The use of Unicode characters in these names can cause problems with a variety of non-Unicode compliant applications. To achieve the highest portability, all the names should start with a simple alphabetic character, A to Z. The leading alphabetic character should be followed by one or more alphabetic characters followed by zero or more numeric. The use of period "." and underscore "_" should be avoided. In other words, a name should follow the following regular expression: [A-Z][A-Z]+[0-9]*.
A further restriction is that the set of table and field names be disjoint. That is, no table has the same name as a field in any table in the database.
In addition to the restrictions above, names should avoid conflict with reserved words and standard identifiers. There are three categories of names to avoid: SQL reserved words, SQL field types, and XML specific identifiers.
One final restriction is to avoid problems with the Delphi development environment. Names should not conflict with any of the Delphi reserved words. Also there are a few words that cause conflict with properties and such that although not reserved should be avoided.
Below is a list of reserved words found in the Transact SQL book from Microsoft.
| ADD | CURRENT_TIMESTAMP | GROUP | OPENQUERY | SERIALIZABLE |
| ALL | CURRENT_USER | HAVING | OPENROWSET | SESSION_USER |
| ALTER | CURSOR | HOLDLOCK | OPTION | SET |
| AND | DATABASE | IDENTITY | OR | SETUSER |
| ANY | DBCC | IDENTITYCOL | ORDER | SHUTDOWN |
| AS | DEALLOCATE | IDENTITY_INSERT | OUTER | SOME |
| ASC | DECLARE | IF | OVER | STATISTICS |
| AUTHORIZATION | DEFAULT | IN | PERCENT | SUM |
| AVG | DELETE | INDEX | PERM | SYSTEM_USER |
| BACKUP | DENY | INNER | PERMANENT | TABLE |
| BEGIN | DESC | INSERT | PIPE | TAPE |
| BETWEEN | DISK | INTERSECT | PLAN | TEMP |
| BREAK | DISTINCT | INTO | PRECISION | TEMPORARY |
| BROWSE | DISTRIBUTED | IS | PREPARE | TEXTSIZE |
| BULK | DOUBLE | ISOLATION | PRIMARY | THEN |
| BY | DROP | JOIN | TO | |
| CASCADE | DUMMY | KEY | PRIVILEGES | TOP |
| CASE | DUMP | KILL | PROC | TRAN |
| CHECK | ELSE | LEFT | PROCEDURE | TRANSACTION |
| CHECKPOINT | END | LEVEL | PROCESSEXIT | TRIGGER |
| CLOSE | ERRLVL | LIKE | PUBLIC | TRUNCATE |
| CLUSTERED | ERROREXIT | LINENO | RAISERROR | TSEQUAL |
| COALESCE | ESCAPE | LOAD | READ | UNCOMMITTED |
| COLUMN | EXCEPT | MAX | READTEXT | UNION |
| COMMIT | EXEC | MIN | RECONFIGURE | UNIQUE |
| COMMITTED | EXECUTE | MIRROREXIT | REFERENCES | UPDATE |
| COMPUTE | EXISTS | NATIONAL | REPEATABLE | UPDATETEXT |
| CONFIRM | EXIT | NOCHECK | REPLICATION | USE |
| CONSTRAINT | FETCH | NONCLUSTERED | RESTORE | USER |
| CONTAINS | FILE | NOT | RESTRICT | VALUES |
| CONTAINSTABLE | FILLFACTOR | NULL | RETURN | VARYING |
| CONTINUE | FLOPPY | NULLIF | REVOKE | VIEW |
| CONTROLROW | FOR | OF | RIGHT | WAITFOR |
| CONVERT | FOREIGN | OFF | ROLLBACK | WHEN |
| COUNT | FREETEXT | OFFSETS | ROWCOUNT | WHERE |
| CREATE | FREETEXTTABLE | ON | ROWGUIDCOL | WHILE |
| CROSS | FROM | ONCE | RULE | WITH |
| CURRENT | FULL | ONLY | SAVE | WORK |
| CURRENT_DATE | GOTO | OPEN | SCHEMA | WRITETEXT |
| CURRENT_TIME | GRANT | OPENDATASOURCE | SELECT |
Below is a list of field types found in the Transact SQL book from Microsoft.
| binary | decimal | nchar | smalldatetime | tinyint |
| bit | float | ntext | smallint | uniqueidentifier |
| char | image | numeric | smallmoney | varbinary |
| cursor | int | nvarchar | text | varchar |
| datetime | money | real | timestamp |
Below is a list of words used in XML DTDs.
| ATTLIST | ENTITY | IGNORE | NMTOKENS | SYSTEM |
| CDATA | FIXED | IMPLIED | NOTATION | |
| DOCTYPE | ID | INCLUDE | PUBLIC | |
| ELEMENT | IDREF | NDATA | REQUIRED | |
| ENTITIES | IDREFS | NMTOKEN | SDATA |
Below is a list of reserved words in Delphi
| and | downto | initialization | private | then |
| array | else | inline | procedure | threadvar |
| as | end | interface | program | to |
| asm | except | is | property | try |
| at | exports | label | protected | type |
| automated | file | library | public | unit |
| begin | finalization | mod | published | until |
| case | finally | nil | raise | uses |
| class | for | not | record | var |
| const | function | object | repeat | while |
| constructor | goto | of | resourcestring | with |
| destructor | if | on | set | xor |
| dispinterface | implementation | or | shl | |
| div | in | out | shr | |
| do | inherited | packed | string |
Below is a list of words that cause problems if used as field or table names in Delphi
| locale |