For many years, I have been an active contributor to the MSDN Forums, including one of my favorite forums, Transact-SQL. Besides the obvious benefit of helping customers solve their current SQL challenges, with each answer I provide I expand my knowledge and understanding of SQL Server. Inevitably, after posting an answer, several other answers will be provided by the stars of the TSQL forum, each correct in that they solve the problem, but all syntactically very different. It is from these answers where I learn and grow the most. Oftentimes, I wish I could ask the people who provide the solutions for a summary of what they were thinking when they wrote the solution. Are they considering query plans, performance, elegance, complexity, readability/maintainability, something else? There are many different ways within SQL Server to solve the same problem and it is a great learning exercise to see various solutions.
With that, I am excited to introduce a new blog series that will focus on a single TSQL challenge per entry. I have reached out to a few of the top answerers in the TSQL forum and they graciously have agreed to contribute. With each entry, I will frame the problem, then provide solutions from different contributors along with their thoughts on HOW they solved the problem.
The forums provide an endless set of topics for this series, so hopefully we can all work together to provide a good learning exercise to help everyone better understand TSQL.
Hope you enjoy,Sam Lester (MSFT)