Qualify your table name

September 28, 2007

Thanks to Tim for reminding me what a headache this can be!

I’m guilty of creating SQL statements like so:

SELECT testfield FROM sometable

Today that caused a real problem. An error that was incredibly difficult to find.

The error message was:

11 >= 11 null

Seriously, that was the error message displayed by Coldfusion.

The answer was that we should’ve qualified the table name like so:

SELECT testfield FROM [sometable]

You can take it a step further and do this for your columns as well. I usually do not qualify my column names unless it’s necessary, but qualifying your table name is easy and may save your hair.


Leave Your Comment

Your email address will not be published. Required fields are marked *

about me

An information technology professional with twenty four years experience in systems administration, computer programming, requirements gathering, customer service, and technical support.