;WITH n(n) AS ( SELECT 1 UNION ALL SELECT n+1 FROM n WHER...

0

Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

;WITH n(n) AS
(
    SELECT 1
    UNION ALL
    SELECT n+1 FROM n WHERE n < 20000
)
SELECT n FROM n
left join postswithdeleted d on d.id = n
where d.posttypeid is null
ORDER BY n
OPTION (MAXRECURSION 20000);

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results