Common Table Expressions (CTE)

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. 

2019-11-24

405 reads

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. 

2019-11-12 (first published: )

1,072 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.

2015-03-18

1,904 reads

Blogs

Built-in Duotone Image Filter, Editor Navigation via Persistent List View, and Other Block Editor Improvements

By

The next batch of exciting updates to the block editor is live on WordPress.com....

Are You a Diverse User Group or Event?

By

One of the things that I’ve seen crop up at various points in my...

Daily Coping 18 Jun 2021

By

I started to add a daily coping tip to the SQLServerCentral newsletter and to...

Read the latest Blogs

Forums

Deceptive Visualizations

By Steve Jones - SSC Editor

Comments posted to this topic are about the item Deceptive Visualizations

Argument syntax for SSIS Execute Process Task Editor

By Isabelle2378

Hi, I'm trying to modify my SSIS packages to use sftp and since it...

Seeking input on Best Method to Join on First or Last Row in a 1:M Join

By YSLGuru

I have included the DDL to re-create the 2 tables in this examples. I...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers