What is T-SQL Tuesday?
T-SQL Tuesday is the brain-child of MVP Adam Machanic (blog|twitter). It happens once a month on the 2nd Tuesday and is hosted by a different person in the SQL community each time. The idea is to get the SQL Community blogging on a common topic on a single day of the month after which a round-up of all the participating posts are done by the hosting blog owner to give the SQL community a one-stop shop of some great articles on a single topic.
What is the topic for July?
The topic for July is “T-SQL Best Practices”. If you work with SQL Server, then undoubtedly you would have had to write T-SQL queries atleast once or would have had to debug the seemingly useful piece of T-SQL code written by your developers to find out where the performance bottleneck or problem was. Your post for this month’s revolving blog party could be along one of the areas:
a. A set of T-SQL best practices that you follow in your shop that or you believe that should be followed always. It could be as specific as for writing only linked server queries or writing queries for SSIS packages etc.
b. An issue that you resolved because certain T-SQL best practices were not followed.
c. A workaround that you used (like query hints) to resolve an issue where T-SQL best practices couldn’t be implemented due to involvement of a third party solution.
Why did I choose this topic?
Over the years of troubleshooting SQL performance related issues, I have found on multiple occasions that the T-SQL query in question was performing badly because certain best practices for writing that piece of code were not followed and the one responsible for the development had not foreseen that such an oversight could become a bottleneck when the data or the number of users increased. So, I thought it would be a good idea to get the SQL Community’s thoughts around best practices in this area. Sometimes, the most obvious things are the easiest to overlook!
What are the Rules?
T-SQL Tuesday has some basic rules which are pretty easy to follow.
1. Your post must be published between 00:00 GMT Tuesday July 12, 2011, and 00:00 GMT Wednesday July 13, 2011.
2. Your post must contain the T-SQL Tuesday logo from above and the image should link back to this blog post.
3. Trackbacks should work, but if you don’t see one please link to your post in the comments section below so everyone can view your blog post.
Good-to-have
- Include a reference to T-SQL Tuesday in the title of your post
- Tweet about your post using the hash tag #TSQL2sDay
- Being creative always fetches brownie points and gets a smile from the reader!
So now it’s time for:
SELECT [content] FROM [dbo].[tblbrain] WHERE [content_type] = ‘T-SQL’
Before I wrap-up this post, a big thanks to Adam for letting me host T-SQL Tuesday for this month!
Here is mine:
http://sqlblog.com/blogs/aaron_bertrand/archive/2011/07/12/t-sql-tuesday-20-t-sql-best-practices.aspx
LikeLike
Thanks for the post. It’s a different experience and I am enjoying being the host. 🙂
LikeLike
Thanks for the post Erin. Your posts are always a good read!
LikeLike
Thanks for the post Aaron. Was looking forward to your contribution.
LikeLike
Pingback: SQL Server DBA
Glad you liked the topic. Thanks for the post.
LikeLike
My contribution. Many thanks!
http://key2consulting.com/Blogs/jbacani/2011/07/11/t-sql-tuesday-20-%E2%80%93-t-sql-best-practices-%E2%80%93-formatting-versus-%E2%80%9Cthe-process-worked-and-that%E2%80%99s-what-matters-most-right%E2%80%9D/
LikeLike
Gladly participated, and here are my few pointers regarding T-SQL Best Practices
http://www.extofer.com/2011/07/tsql-tuesday-20-t-sql-best-practices.html
Gabe aka extofer
LikeLike
My humble contribution to this month’s event is here:
http://nancyhidywilson.wordpress.com/2011/07/12/tsql2sday-20-t-sql-best-practices/
LikeLike
Sorry I have two entries. I didn’t see my trackback (and it seems to fall through just about every other T-SQL Tuesday).
LikeLike
No issues.
LikeLike
My Contribution:
http://leka.com.br/2011/07/12/t-sql-tuesday-20-melhores-prticas/
LikeLike
Pingback: TSQL Tuesday #20: T-SQL Best Practices « Cleveland DBA
Pingback: T-SQL Tuesday and Best Practices – SQL is a Set-Based Language « Carlos Bossy's Blog
Great subject , find post on http://www.sqlserver-dba.com/2011/07/filtered-statistics-t-sql-best-practises-for-t-sql-tuesday.html
LikeLike
Pingback: T-SQL Tuesday #20 Wrap-up and a few smiles « TroubleshootingSQL
Pingback: TSQL2sday #20 – T-SQL Best Practices « Nancy Hidy Wilson's Blog
Here are some SQL programming guidelines and best practices we collected:
* Do not use SELECT * in your queries.
* Always use table aliases when your SQL statement involves more than one source.
* Use the more readable ANSI-Standard Join clauses instead of the old style joins.
* Do not use column numbers in the ORDER BY clause.
* Always use a column list in your INSERT statements.
* Don’t ever use double quotes in your T-SQL code.
* Do not prefix your stored procedure names with “sp_”.
* Always use a SQL formatter to format your sql like Instant SQL Formatter(Free and Online)
You can check detailed explanation of those best practices in this blog:
http://www.dpriver.com/blog/2011/09/27/a-list-of-sql-best-practices/
LikeLike
Pingback: T-SQL best practice SQL server « SqlserverBlogForum
Pingback: TSQL Tuesday #026 – Second Chances | Dave's SQL Blog
Pingback: T-SQL Tuesday Topics – Febuary 2012 « Voice of the DBA
Pingback: #Meme15 Meets #T-SQL Tuesday « Chris Shaw's Weblog
Pingback: T-SQL Tuesday Topics – December 2012 Update « Voice of the DBA
Pingback: 2011 T-SQL Tuesdays – T-SQL Tuesday
Pingback: T-SQL Tuesday #020 – T-SQL Best Practices – T-SQL Tuesday