Skip to: Site menu | Main content

Email LinkedIn

Blog...

Qualify your table name.

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.

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)