For more information on Common Table Expessions and performance, take a look at my book at Amazon.com: Common Table Expressions Joes 2 Pros®: A CTE Tutorial on Performance, Stored Procedures, Recursion, Nesting and the use of Multiple CTEs There are many reasons that a Temp Table, Table Variable or Common Table Expression can be a good solution, but there is …

Temp Table vs Table Variable vs CTE and the use of TEMPDB. Read more »

Thanks to everyone who attended my CTE presentation at SQL Saturday in Olympia Washington today.   Have a great rest of the day.  As promised I have posted the slides and sample TSQL queries here.  If you have any questions, please get in touch with me on Twitter  @SqlEmt  Remember to follow me on Twitter to stay informed of future presentations. Download the Presentation Here: Unleashing …

Unleashing CTEs in SQL Server – Slides and Sample Code – Olympia SQL Saturday Read more »

I just finished the Exploring the TSQL Enhancements in SQL Server 2012 presentation at SQL Saturday 166 in Olympia Washington. Thanks everyone who attended, I hope that you learned something useful. Here is the slides and sample code to download: Whats New in TSQL 2012 If you have any questions, please get in touch with me on Twitter  @SqlEmt  Remember to follow me …

Exploring the TSQL Enhancements in SQL Server 2012 – Slides and Sample Code Read more »

Thanks to everyone who attended my CTE presentation at SQL Saturday in Portland Oregon today.   Have a great rest of the day.  As promised I have posted the slides and sample TSQL queries here.  If you have any questions, please get in touch with me on Twitter  @SqlEmt  Remember to follow me on Twitter to stay informed of future presentations. …

Unleashing Common Table Expressions in SQL Server – Slides and Sample Code Read more »

Its going to be a great day!   Ready for SQL Saturday 172 in Portland today, looking forward learning lots, and sharing my CTE Presentation with those who want to learn about Common Table Expressions. Please come to my CTE if you are interested in any of the following: 1.What is a Common Table Expression 2.Simple CTE 3.CTE – Subquery …

SQL Saturday #172 in Portland Oregon Read more »

On the next two Saturdays I will be presenting the Unleashing Common Table Expressions presentation at SQL Saturday 172 in Portland Oregon, and SQL Saturday 166 in Olympia Washington. As part of refreshing the presentation I have added a few more examples of how CTE’s can be used in common practice. Using a CTE to parse a Query String. Using …

Unleashing Common Table Expressions Read more »

Have you ever needed to generate a list of dates for the last 30 days.  There are lots of different ways to do this with TSQL, but one way is with a CTE, where you can then left join against it with another query to generate a list of all  dates in a result set, along with the dates for …

Recursive CTE to Calculate Dates for the Last 30 Days Read more »