Do I have to use UPPERCASE identifiers?


Short answer: No, you don't.

Long answer:

Firebird allows you to write upper case, lower case or mixed case identifiers and it is case insensitive, i.e.

SELECT * FROM Employee;
SELECT * FROM EMPLOYEE;
SELECT * FROM employee;

are identical statements. However, Firebird stores identifiers without preserving the case you used (read below why), so when some admin tool extracts them from the system tables, you get all uppercase names.

If you wish to use lowercase, you need to quote each identifier with double quotes. Be careful, once you've done it, you need to do it always.

SELECT * FROM "Employee";
SELECT * FROM "EMPLOYEE";
SELECT * FROM "employee";

are three different statements. When you use quotes, Firebird stores the name as you wrote it (that's why it can't preserve the case - it needs lower case to detect case-sensitive column names).

You can also use quotes if you wish to store otherwise illegal characters like dot, comma, colon, question mark, national characters (non ASCII), or some of reserved SQL keywords (to have a column called User or Date for example).

Some users prefer not to complicate things, and don't use quotes at all, others love to have mixed case preserved and don't mind the double quotes. Most administration tools (FlameRobin included) have a nice configuration option to suit your needs: quote just what is needed, or quote always.


Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.



All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous