• CELKO (7/9/2012)


    Since that would require storing temporal data as character based data, I have to ask why would you do that?

    I am naming a time period because T-SQL does not have an INTERVAL data type. No temporal math is done with it. It is the key to INTERVALs in the Calendar and report periods table.

    This convention happens to have some major advantages:

    language free

    fixed length & short

    easy regular expressions in DDL and DML

    sorts with ISO-8601 display format

    It is fast in a query.

    Think about looking for all the Januaries in English versus "report_month LIKE '____-01-00' instead. Anyone got a better way to name a time period?

    Maybe but the real key here is that I wouldn't name a time period, Joe. Why not use the number of months since "Date zero"?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)