Convert Date

  • Jeff Moden (6/4/2009)


    Other than a calendar table, do you have an example where storing a date in the format of 1/12/2009 in a table is actually the right thing to do?

    [font="Verdana"]Nope. As I said, it's the exception, and I should have said the one and only exception.[/font]

    Jeff Moden (6/4/2009)


    I'll just bet that except for day and month names, you store the consituent parts as INT, SMALLINT, and TINYINT and not CHAR or VARCHAR. Do you do things like store "Q1" or "M6"? I'm thinking that you don't.

    [font="Verdana"]You'd be mostly correct. We do use financial period names.[/font]

  • You actually store dates like 1/12/2009 in that format in a calendar table? What do you use those for? I'm asking because I'm curious. I've never seen anyone store such formatted dates in a calendar table before. Perhaps just to make it easy to print reports on date lookups?

    --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)

  • [font="Verdana"]We do have a field named "calendar_date_ddmmyyyy", and I suspect it was created by one of the dodgy consultants we had in who we've been cleaning up after. I don't know why it's there: I've certainly never used it. So I'd hardly use that as an argument for storing formatted dates.

    No, the financial period names we store are more in the form "(1970-11)May-1970". So they're used for grouping, which I think is valid.

    [/font]

  • Bruce W Cassidy (6/4/2009)


    [font="Verdana"]We do have a field named "calendar_date_ddmmyyyy", and I suspect it was created by one of the dodgy consultants we had in who we've been cleaning up after. I don't know why it's there: I've certainly never used it. So I'd hardly use that as an argument for storing formatted dates.

    No, the financial period names we store are more in the form "(1970-11)May-1970". So they're used for grouping, which I think is valid.

    [/font]

    Cool. Thanks for the feedback Bruce. And understood on the dodgy consultant. I have the same problem with many 3rd party packages. Folks just don't test for things like performance and scalability.

    --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)

Viewing 4 posts - 16 through 18 (of 18 total)

You must be logged in to reply to this topic. Login to reply