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-25 (first published: )

649 reads

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,859 reads

Blogs

SQL Prompt Quick Access to Helper Code

By

We’ve been doing some events as part of the Redgate Roadshow, and at one...

Eleven chapters of my data architecture book are available

By

As I have mentioned in prior blog posts, I have been writing a data...

Speaking at SQL Saturday Boston 2023

By

I’m happy to announce that I will be speaking at SQL Saturday Boston on...

Read the latest Blogs

Forums

Works on all other sql2022 servers but not on production. - must be dropped

By krypto69

HI We have a small utility that is giving us a "#table is missing...

Convert common Separated number to # table

By ralahari

@reportParameter 1008,1009,1011,1014 values need to insert to #Table Note: @reportParameter is not returning values...

Things to be considered before implementing database auditing

By vsamantha35

Hi All, As part of security compliance, we are told to audit DML &...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers