SQLServerCentral Editorial

SQL Profanities

,

Cursors, Views, Functions, Dynamic SQL, Global Temp Tables, Undocumented Procedures; these are just a few of the phrases that have been deemed "SQL Profanities" to certain individuals. I am sure some of you are cringing after hearing all those words at once, but I strongly believe there is a use for all of these "profanities" as long as they are used correctly.

I think some capabilities in SQL Server have such a negative connotation that they are avoided at all costs. It is true that all of these features can lead to inefficient code, but a select statement in the wrong hands can lead to inefficient code as well. Does this mean we should avoid querying data all together to improve efficiency because someone may write a bad query?

I am in no way promoting the use of bad code, I just don't agree with blanket statements claiming you should never use a certain feature that is available in SQL Server. I think you should always strive to write the best code you can, but on the other hand I am not afraid to use the tools that I have been given. I also know that there are several ways to do the same thing; some better than others. Even the best SQL Coders may not always think of the most efficient way to write a query. If someone comes along and provides a better solution, I chalk it up as a learning experience and gladly accept the advice.

Instead of just vowing to never use certain functionality, try to come up with your best solution and have it evaluated using a code review. If you use something that can be easily abused such as a cursor, it should be reviewed and accepted by the group. I know not all of us have the luxury of working with a group of DBA's where you can have formal code reviews, but you can always reach out to the Online Community for help. There are more than enough people willing to help you find the best solution. Sometimes the best solution may be the one that you have been trying to avoid all along.

At the end of the day you have to get the job done. The end user does not care what happens in the background as long as they have an acceptable working solution. It is our job as DBA's and Developers to provide the best possible solution in the time frame we have been given; even if it means being a little "profane" every now and then.

Ken Simmons


The Voice of the DBA Podcasts

Everyday Jones

The podcast feeds are now available at sqlservercentral.podshow.com to get better bandwidth and maybe a little more exposure :). Comments are definitely appreciated and wanted, and you can get feeds from there.

Overall RSS Feed:

or now on iTunes!

Today's podcast features music by Everyday Jones. No relation, but I stumbled on to them and really like the music. Support this great duo at www.everydayjones.com.

I really appreciate and value feedback on the podcasts. Let us know what you like, don't like, or even send in ideas for the show. If you'd like to comment, post something here. The boss will be sure to read it.

Rate

3.5 (2)

You rated this post out of 5. Change rating

Share

Share

Rate

3.5 (2)

You rated this post out of 5. Change rating