• I think its the fact that the Row_number() requires an order by statement thus a sort, rather than an Identity which assigns the number as the data is returned.

    I'd not heard or seen Ben-gans cascading cross join CTE, but have now and it looks like a good solution for large number values, add on that it can easily be wrapped in a Inline table function and you save yourself a permanant table in your DB.

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices