Posted by Toby A Inkster on 05/10/07 17:29
Chung Leong wrote:
> You need square brackets around the table name if it contains special
> characters.
Square brackets are MS Access/SQL Server proprietary syntax. It is better
to use "double quotes" which Microsoft SQL Server supports along with
almost every other SQL database. [Notable exceptions: Microsoft Access,
MySQL (IIRC, version 5 has a setting to enable support for double-quoted
identifiers, but it's off by default)]
Even if you don't plan on porting this code to another platform, this is
not just a question of "code portability" but "brain portability". It's
best to be in the mindset of using standards-compliant SQL whenever it's
both possible and practical. Otherwise, you'll struggle when you're asked
to develop something for a different RDBMS.
(This is one of the many reasons I prefer PostgreSQL over MySQL: MySQL has
some fairly gratuitous deviations from the SQL standard in some fairly
major areas.)
--
Toby A Inkster BSc (Hons) ARCS
http://tobyinkster.co.uk/
Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
[Back to original message]
|