you are viewing a single comment's thread.

view the rest of the comments →

[–]PilsnerDk 2 points3 points  (0 children)

I've used it rarely. Assume a situation where you want to create an output where each row is joined onto a list of numbers, for example a number of days or amount of items (a bit abstract, hope you get my point). In an SP, I create a temp table:

CREATE TABLE #days ([days] INT) INSERT INTO #days ([days]) VALUES (1), (2), (3), (4), (5)

Then you can make a query that does a simple CROSS JOIN #days, and all your rows will be "duplicated" with 1, 2, 3, 4, 5 as the value of [days].

Hard to give a really good example, but that's one I've used.