I happened to solve a puzzle.
Display 1 to 100 in SSMS without using any loop or table or table variable or even cursor.
I gave up, then got the solution from requester.
Always wonder with common table expressions. happy querying
Display 1 to 100 in SSMS without using any loop or table or table variable or even cursor.
I gave up, then got the solution from requester.
WITH cte
AS (SELECT 1 Num UNION ALL SELECT num + 1 FROM cte WHERE num < 100) SELECT * FROM cte Always wonder with common table expressions. happy querying
No comments:
Post a Comment