What year is it? Let me check the database...




  • Found this very useful table in one of our DBs today. I don't know how I ever got along without it before. Why does it stop at 2010? Who knows.



  • Because sometimes it's easier to do a JOIN than to do a string conversion.

    Delayed millenium bug perhaps?



  • year_id     name
    2013 Luigi




  • Ah, yes. year_id: PK, int, not null. Name: varchar(50), not null. It all makes so much sense in retrospect.

    We're all set for those 50 digit years.



  • This would make sense if Name is a varchar field, and the table is used for data warehousing or reporting. In any other circumstance I'd call it a WTF.



  •  @mikeTheLiar said:


    Why does it stop at 2010? Who knows.

    This application will NEVER be used for more than four years.  But just in case, I'll go up to the next decade.  We'll never hit it.



  • @anachostic said:

     @mikeTheLiar said:


    Why does it stop at 2010? Who knows.

    This application will NEVER be used for more than four years.  But just in case, I'll go up to the next decade.  We'll never hit it.

    I retire in 2010; after that it's someone elses problem. Let them deal with it.


  • Discourse touched me in a no-no place

    @mikeTheLiar said:


    Ah, yes. year_id: PK, int, not null. Name: varchar(50), not null. It all makes so much sense in retrospect.

    We're all set for those 50 digit years.

    I bet varchar(50) is the default. Not a good reason, but an explanation.

    ETA: I mean, 50 is the default length of a varchar, that is.



  • @anachostic said:

     @mikeTheLiar said:


    Why does it stop at 2010? Who knows.

    This application will NEVER be used for more than four years.  But just in case, I'll go up to the next decade.  We'll never hit it.

    People said the same thing in 1993.

     



  • @El_Heffe said:

    @anachostic said:

     @mikeTheLiar said:


    Why does it stop at 2010? Who knows.

    This application will NEVER be used for more than four years.  But just in case, I'll go up to the next decade.  We'll never hit it.

    People said the same thing in 1993.

     

    I can personally guarantee* that Community Server 2007 will no longer be used by the year 2107.

    *i cannot personally guarantee


  • Discourse touched me in a no-no place

    @mikeTheLiar said:

    We're all set for those 50 digit years.
    Sorta makes a nonsense of RFC2550 and the Long Now Foundation doesn't it?



  • @Ben L. said:

    @El_Heffe said:
    @anachostic said:
    @mikeTheLiar said:
    Why does it stop at 2010? Who knows.

    This application will NEVER be used for more than four years.  But just in case, I'll go up to the next decade.  We'll never hit it.

    People said the same thing in 1993.

     

    I can personally guarantee* that Community Server 2007 will no longer be used by the year 2107.

    *i cannot personally guarantee

    I can personally guarantee that you will not be using Community Server in the year 2107.

     



  • @mikeTheLiar said:


    Ah, yes. year_id: PK, int, not null. Name: varchar(50), not null. It all makes so much sense in retrospect.

    We're all set for those 50 digit years.

     

    Gotta think long term.

    What if people are still using this software when the Universe gets into heat death, and then randomly inflation starts again,  a few billion times?

     



  • @Mcoder said:

    @mikeTheLiar said:


    Ah, yes. year_id: PK, int, not null. Name: varchar(50), not null. It all makes so much sense in retrospect.

    We're all set for those 50 digit years.

     

    Gotta think long term.

    What if people are still using this software when the Universe gets into heat death, and then randomly inflation starts again,  a few billion times?

     

    What if the world starts revolving around the sun faster?


  • @Ben L. said:

    @Mcoder said:

    What if people are still using this software when the Universe gets into heat death, and then randomly inflation starts again,  a few billion times?

     


    What if the world starts revolving around the sun faster?
     

     What if the application is exported to Mercury or Kepler-10b?

     



  • What if I poop out a live ferret?



  • What if I had a bag of a bajillion golf balls?



  • @blakeyrat said:

    year_id     name
    2013 Luigi

     

    post of the year

     

    (of mario)

     



  • @blakeyrat said:

    What if I poop out a live ferret?
     

     UPDATE lkup_year SET name = 'The year Blakeyrat pooped out a live ferret' WHERE year_id = DATEPART(year, getdate());



  • This could actually make complete sense if the application is to be used in different cultures. For example, this year is 平成26 in Japan, the 26th year of the 平成 (Heisei) emperor (known in the west as Emperor Akihito). This is not obscure: while Japanese people do use the Gregorian calendar and know full well that it is 2014, 平成26 is used far more often in everyday life.

    This lookup table would allow a translation from Gregorian to Japanese years (and other cultures do similar things) for output. More important, it could also handle years before 1989, which were years of the 昭和 (Showa) emperor (known better to us as Hirohito).

    • 1987 昭和62
    • 1988 昭和63
    • 1989 平成1 (also called 平成元年, the change actually happened on Hirohito's death, January 8th of that year)
    • 1990 平成2
    • 1991 平成3
    • ...


  • @gramie said:

    This could actually make complete sense if the application is to be used in different cultures. For example, this year is 平成26 in Japan, the 26th year of the 平成 (Heisei) emperor (known in the west as Emperor Akihito). This is not obscure: while Japanese people do use the Gregorian calendar and know full well that it is 2014, 平成26 is used far more often in everyday life.

    This lookup table would allow a translation from Gregorian to Japanese years (and other cultures do similar things) for output. More important, it could also handle years before 1989, which were years of the 昭和 (Showa) emperor (known better to us as Hirohito).

    • 1987 昭和62
    • 1988 昭和63
    • 1989 平成1 (also called 平成元年, the change actually happened on Hirohito's death, January 8th of that year)
    • 1990 平成2
    • 1991 平成3
    • ...

    Unless your working with a near archaic language or some heavy restrictions as to what libraries you can use (like not-invented-here syndrome), then you're still doing it wrong.



  • @DrakeSmith said:

    @gramie said:

    This could actually make complete sense if the application is to be used in different cultures. For example, this year is 平成26 in Japan, the 26th year of the 平成 (Heisei) emperor (known in the west as Emperor Akihito). This is not obscure: while Japanese people do use the Gregorian calendar and know full well that it is 2014, 平成26 is used far more often in everyday life.

    This lookup table would allow a translation from Gregorian to Japanese years (and other cultures do similar things) for output. More important, it could also handle years before 1989, which were years of the 昭和 (Showa) emperor (known better to us as Hirohito).

    • 1987 昭和62
    • 1988 昭和63
    • 1989 平成1 (also called 平成元年, the change actually happened on Hirohito's death, January 8th of that year)
    • 1990 平成2
    • 1991 平成3
    • ...

    Unless your working with a near archaic language or some heavy restrictions as to what libraries you can use (like not-invented-here syndrome), then you're still doing it wrong.

    In order to need this table format, you'd need a language that couldn't subtract integers. Good luck with that.


  • @DrPepper said:

    @anachostic said:

     @mikeTheLiar said:


    Why does it stop at 2010? Who knows.

    This application will NEVER be used for more than four years.  But just in case, I'll go up to the next decade.  We'll never hit it.

    I retire in 2010; after that it's someone elses problem. Let them deal with it.

     

    At one point we had a sanity check in our codebase that made sure a certain date field was before October 20, 2014.

    That particular date field defaults to a year after the current date, so October 20, 2013 was a fun day.

     


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.