• Jeff Moden (6/20/2009)


    It's ok... most folks don't usually have a Tally table when they first hear of it and don't understand that you need to build one. Most think that it comes with SQL Server. 😛

    You know, as much as it helps out, maybe it ought to. Put a million (edit: or billion) row tally table in master, and people wouldn't have an excuse... :w00t:

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2