• michael vessey (5/2/2012)


    Cadavre (5/2/2012)


    michael vessey (5/2/2012)


    depends if you need a BIGINT or not - i'd suggest just using yours for anything when max-min > 32,767 - otherwise use the nice small (low resource) version

    Actually, you should pretty much never use recursive CTEs for counting. See this article for why[/url].

    run the CTE and the cross join version you posted and look at the execution plans.... then see the difference

    the CTE has it's place when dealing with small numbers

    Did you have a gander at Jeff Moden's article that I linked? --> http://www.sqlservercentral.com/articles/T-SQL/74118/[/url]


    Forever trying to learn
    My blog - http://www.cadavre.co.uk/
    For better, quicker answers on T-SQL questions, click on the following...http://www.sqlservercentral.com/articles/Best+Practices/61537/
    For better, quicker answers on SQL Server performance related questions, click on the following...http://www.sqlservercentral.com/articles/SQLServerCentral/66909/