On 19/05/2009 6:47 PM, Chanas, Olivier wrote:
> Hi all,
> 
> I would like to know what are the allowed characters to build a column name.
> Is there some limitation ?

OTTOMH (because it's not all in one convienient place in the docs):

This applies to names of columns, tables, triggers, indexes, 
constraints, etc etc.

Basic: [A-Za-z_][A-Za-z_0-9]* (using regular expression notation)
AFAIK the rules for non-ASCII alphabetics and digits are not spelled out.

Must not be a keyword aka reserved word.

To use a reserved word, or some other character, quote with "" 
(preferred, SQL standard). If you are desperate to include a " in the 
name, double it. E.g. "fu bar", "fu""bar"

Alternatives:
(1) mySQL compatibility: quote with ' (similar desperation clause)
E.g. 'fu bar', 'fu''bar'

(2) MS SQL Server compatibility: quote by bracketing. If desperate to 
include a [, DON'T double it. If desperate to include a ], use " or ' 
quoting. E.g. [fu bar], [fu[bar], "fu]bar"

Note that equivalence of names is determined after stripping out the 
quoting and then lower-casing. So the following are all effectively the 
same:

"O'Brien"
'O''Brien'
[O'Brien]
"o'brien"

What lower-casing means exactly in the non-ASCII realm, I know not. 
Include a German eszett or a Turkish dotless i or dotted I at your peril 
;-)

HTH

John




_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to