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

59 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: )

474 reads

Function and Queries to Convert Hierarchical Adjacency to Nested Json Arrays

  • Revision

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-08

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

2018-03-21 (first published: )

705 reads

Blogs

SQLSaturday Orlando Notes – Large Printed Schedules

By

One of the things we’ve done most years in Orlando is to print poster...

Upgrading Windows 10 Home to Pro

By

I use Hyper-V and a few other things that require Windows 10 Pro. When...

Power Platform Quick Tips – Episode 03: Documenting Power Automate Flow Logic

By

Welcome back to my series on Power Platform quick tips! In this episode you...

Read the latest Blogs

Forums

Impact value about missing indexes

By msimone

is there relation between Impact from sys.dm_db_missing_index_group_stats and Impact from cache plan? Thanks for...

Migrating DB encrypted by master key

By CharlieRL

I'm migrating DBs from a 2008 R2 instance onto a 2017 instance.  I have...

SQL Monitoring

By SQLEYES

Hi All, I have SQL 2012 instance on a vm server  which I am...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers