DECLARE @BatchSize INT = 50000; DECLARE @Offset INT = 0; ...

0

Please login or register to vote for this query.

(click on this box to dismiss)

The Workplace Meta

Q&A about the site for members of the workforce navigating the professional setting

DECLARE @BatchSize INT = 50000;
DECLARE @Offset INT = 0;

WHILE 1 = 1
BEGIN

    select 
      t.tagName,
      e.body as 'Excerpt',
      w.body as 'WikiBody'
    from tags t
    left join Posts e
      on t.ExcerptPostId = e.Id
    left join Posts w
      on t.WikiPostId = w.Id
    order by t.tagName

    OFFSET @Offset ROWS
    FETCH NEXT @BatchSize ROWS ONLY;

    IF @@ROWCOUNT < @BatchSize
        BREAK;

    SET @Offset += @BatchSize;
END

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results