SQL Reserved word or not, that is the question

Here is a problem that we had on a recent project that we were doing maintenance on. The code had some queries with a table called as "user". The code works fine on the production server but gave an error on our development server. The fix? Put brackets around the table name in all the queries.

eg

select name from [user]

instead of

select name from user


We had different versions of SQL Server on the two boxes and user is now a reserved word on the development box version.

We figure out what words are reserved using Pete Freitag's reserved word tool at:

http://www.petefreitag.com/tools/sql_reserved_words_checker/?word=user

ColdFusion MX 7 & MySQL Connection on Windows & Linux

As you know ColdFusion & MySQL connection is a bit tricky. There is a Technote from Adobe. But I also want to give some simple tips.

You can check my simple tutorial via "http://www.howtoforge.com/coldfusion7_mysql4.1_connection".

SQL tricks - creative JOINs with legacy data

Have you ever needed to extract data from old tables and use it in a way the table designer never planned on? This seems to be an all-too-common experience.

Recently, I learned that I could parse a number out of a string field, cast it as an integer, and actually use that result in a JOIN (as if it were a foreign key) to another table's integer primary key. Here is the JOIN part of my query:

...
inner join listings as list
on list.listing_id =
CAST ( RIGHT(op.description,(LEN(op.description)-CHARINDEX(':',op.description))) AS integer )

A few years ago, before I began to understand the power of SQL, I would have done something like this by hand in Excel. Details of the problem and solution are included below if you'd like to read on ...

[More]

BlogCFC was created by Raymond Camden. This blog is running version 5.9.002. Contact Blog Owner
Home | About Us | Software Development | Server Optimization | Client Portfolio | Training | Contact Us

Copyright © TeraTech Inc 2007. All rights Reserved.
TeraTech Inc 405 E Gude Dr Suite 207, Rockville MD 20850 | MAP Map | Tel.: +1 (301) 424 3903 | Fax: +1 (301) 762 8185 | Contact Us