Using UNION with Recursive CTEs in SQL Server

Recursive Common Table Expressions (CTEs) in SQL Server can be combnied with other queries using the UNION or UNION ALL operators. This is typically done within the recursive CTE definition itself, where the anchor member and the recursive member are joined by a UNION ALL. The final result set of the CTE can then be used in an outer query with ...

Posted on Wed, 17 Jun 2026 18:13:48 +0000 by jacinthe