At 07:21 a.m. 26/09/2013, Jake Alley wrote:

>I'm wondering about Firebird not allowing column names to start with an 
>underscore.  I have a database that works fine with Postgresql, Mysql, and 
>Sqlite.  I was excited about using Firebird as an embedded alternative to 
>Sqlite, but have found that Firebird doesn't allow column names to start with 
>underscores.
>
>Am I correct about this?  Is there a way to get around it?

You can use the SQL-standard double-quoting of identifiers and use whatever 
characters you like, including lower case.  Be aware that this technique makes 
identifiers case-sensitive.  Any subsequent references to the double-quoted 
object must be in double quotes.

(In Firebird, if you define an object in double-quotes all caps then you can 
refer to it without the quotes.  That won't work for your identifiers with 
otherwise-illegal characters, though.)


>There are lots of theories about column naming practices.  The reason I use 
>underscores occasionally to start column names is that some names I want to 
>use are  SQL key or reserved words.  For instance "class" is reserved in SQL 
>99.  It usually doesn't matter in statements, but sometimes it can cause hard 
>to troubleshoot problems.  It's easier for me to just name the column "_class."

You can use reserved words as identifiers if you define them in double quotes.  
Just sayin' ....


Helen Borrie, Support Consultant, IBPhoenix (Pacific)
Author of "The Firebird Book" and "The Firebird Book Second Edition"
http://www.firebird-books.net
__________________________________________________________________ 

Reply via email to