Common Table Expressions (CTE)

Stairway to Advanced T-SQL

Stairway to Advanced T-SQL Level 3: Understanding Common Table Expressions (CTEs)

  • Stairway Step

A CTE is a temporary result set defined by a simple query, and is used within the execution scope of a single INSERT, UPDATE, DELETE, or SELECT statement. In this article we will explore how to define and use CTE's.

2018-03-21 (first published: )

91 reads

CTEs and Trees

  • Article

Some new interresting points about trees and CTE in SQL Server : transforming a tree from auto reference to interval model (nested sets), calculating levels in interval model, creating a view of auto ref from an interval model, hierarchical numbering of items, and more. This article includes more examples based on his previous work.

4.11 (9)


5,562 reads


What is a container anyway?


Recently there was a thread on Twitter which established that a lot of IT...

Comparing Execution Plans


When you run a query twice, and get dramatically different run times, your first...

What permissions do temp stored procedures use?


In a performance tuning class I recently took with Brent Ozar (b/t) he mentioned...

Read the latest Blogs


Statistics Profile Results

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Statistics Profile Results

SQL pivot /unpivot

By komal145

I have table something like below. Need the table with status1 and status2. How...

How to use Tally Table to allocate quantity?

By Bruce Dow

I have read many great helpful articles on Tally Tables by Jeff Moden, Lynn...

Visit the forum


SQL Server Q&A from the SQLServerCentral community

Get answers