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. 

2019-11-25 (first published: )

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

2019-11-12 (first published: )

1,644 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

2,787 reads

Blogs

New Job -> Week 2 -> Creating a Checklist

By

This is part of a series of new job blog posts. You can find...

SQL Server 2022 Administration Inside Out

By

SQL Server 2022 Administration Inside Out is now available for pre-order from Microsoft Press. This...

WIT/DEI Mental Health and Wellness Day Challenge to Present

By

Back in December 2019, I started presenting my session on mental health with lots...

Read the latest Blogs

Forums

Calculate log space required on principle for maintenance activity

By ramana3327

Hi all, We have a database configured for asynchronous mirroring. We have some planned...

Get a Date Time Stamp of table when another columns value changes.

By lalitprg2017

I have created a table as per below query CREATE TABLE [dbo].[mydbtemp]( [Datetime] [datetime]...

how to write a query by using some filter patterns in SQL Server?

By maifs

what I want is to apply some filter patterns to search the data. For...

Visit the forum

Ask SSC Logo Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers