inHouseDBA (3/29/2015)
Gurus,Thank you very much for your help.
Is there a way you can explain the interaction of
WITH T(N) AS (SELECT N FROM ( VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL),(NULL)) AS X(N))
with the rest of the solution.
It just creates 10 rows and it doesn't actually matter what those rows contain except that they should be short for performance reasons. The NULL doesn't really mean anything here. It could be 1s, 0s, anything. All it's doing is building "the presence of rows" that will be used in cross joins to build more rows instead of using a much slower loop or much slower recursive CTE.
--Jeff Moden
Change is inevitable... Change for the better is not.