Travis Laborde Blog

play boxing daddy?

ouch! or… why best practices are not just for sprocs :)

Often, I've found that I use some of the more well-known best practices, such as aliasing tables used in a query, fully qualifying the field scope even if you “think” there is no ambiguity, etc., when writing queries that I intend to SAVE (views, sprocs, whatever), but not when I'm running ad-hoc “on-demand” type things.

This post shows at least one example of why it's a good idea to use these practices even when doing your “ad-hoc” queries.

I feel your pain Scott!

Legacy Comments


Mike Swaim
2004-07-05
re: ouch! or... why best practices are not just for sprocs :)
One of the nice things about Oracle is that everything's inside a transaction. I believe that DBArtisan also lets you do ad hoc SQL inside a transaction. That capability's saved my bacon more than once.

Tara
2004-07-06
re: ouch! or... why best practices are not just for sprocs :)
"One of the nice things about Oracle is that everything's inside a transaction. I believe that DBArtisan also lets you do ad hoc SQL inside a transaction. That capability's saved my bacon more than once. "

You can do this in Query Analyzer as well. Just set the option in Tools..Options..Connection Properties (set implicit_transactions). Or set the option in the query window once you connect: SET IMPLICIT_TRANSACTIONS OFF.