• I'm glad you named and shamed the culprit!

    Below is a very quick tally table:

    declare @NoOfRows int = 1000000

    -- cross join allows up to 2047*2047 rows = 4,190,209.

    ;with tally as (

    select top (@NoOfRows) row_number() over(order by a.type) as n

    from master.dbo.spt_values a

    cross join master.dbo.spt_values b

    where a.type = 'P'

    and b.type = 'P'

    )

    select *

    from tally

    Mike Lewis

    @SQLTuna

    sqltuna.blogspot.co.uk[/url]