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) versionActually, 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]