Common Table Expressions (CTE)

Technical Article

Function and Queries to Convert Hierarchical Adjacency to Nested Json Arrays

  • Script

This script converts hierarchical adjacency into nested json rows which contain the recursive "downlines" of each node.  The table-valued function treats each row in the original adjacency as the root node in a recursive common table expression. 

You rated this post out of 5. Change rating

2019-11-12 (first published: )

1,934 reads

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.

You rated this post out of 5. Change rating

2024-04-03 (first published: )

5,457 reads

Blogs

Cloud Databases Made Simple: Creating Your First AWS RDS Instance

By

I recently started full time learning of Amazon Web Services (AWS). I found that...

First Time Speaking with a Mask at an Event

By

Over the past couple of months, I have started losing my ability to talk...

A New Word: Apolytus

By

apolytus– n. the moment you realize you are changing as a person, finally outgrowing...

Read the latest Blogs

Forums

Disk (SCSI) Controllers - Parallel Disk I/O

By lanky_doodle

Hey For SQL Server VMs I use the max number of SCSI controllers supported...

SQL Server Semantic Search (Find Text in External Files)

By Stephen Butland

Dear community, I am trying to search word documents (docx) for a particular drug...

Data Archival: 1 table (Database A) to 1 table (Database B)

By Tava

I'm currently in the process of building an archival  & reporting solution and just...

Visit the forum

Question of the Day

Read Only Replica in SQL Server Standard

Our environment runs using SQL Server Standard. We are implementing Availability groups. Our database has been experiencing high read volumes, so I want to let the application read the Synchronized Secondary replica, as I read that HADR does this. Can we implement this?

See possible answers