Results 1 to 8 of 8

Thread: SQL Datetime

  1. #1
    Join Date
    Dec 2002
    Posts
    1,245

    Unanswered: SQL Datetime

    From SQL BOL:

    Use datetime to store dates in the range from January 1, 1753 through December 31, 9999


    My manager is convinced that there is a SET command in SQL which would allow an admin to 'slide' the daterange. In effect trading off some of the upper values for the lower values.

    Setting aside arguments about the Gregorian vs. Julian calendars and the missing dates when the western world converted, is there such a SET command in SQL? If so, what is?

    Thanks,

    hmscott
    Have you hugged your backup today?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    I suspect that the manager is thinking of the Two digit year cutoff option. It doesn't affect the date range allowed, just how two digit years are interpreted (they are to be avoided in my opinion).

    -PatP

  3. #3
    Join Date
    Dec 2002
    Posts
    1,245
    That's what I was thinking, but far be it from me to believe that I know everything; I wanted to check with some of the experts here before saying anything definitive.

    Regards,

    hmscott
    Have you hugged your backup today?

  4. #4
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    This could be a fun game....

    Quote Originally Posted by Pat Phelan
    I suspect that the manager is ___________________
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by Brett Kaiser
    This could be a fun game....
    I don't think that I ought to play that game! I don't know the manager in question, so I wouldn't have any good guesses to start with, and no way to know if the other player's guesses were any better than mine.

    -PatP

  6. #6
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    And you accused me of being no fun...

    So...are you saying....this should work?

    Code:
    DECLARE @x datetime
    SELECT @x = 'January 1, 1753'
    SELECT @x
    GO
    
    DECLARE @x datetime
    SELECT @x = 'December31, 1752'
    SELECT @x
    GO
    OK, OK, are you working on ANY other plaform instead?
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  7. #7
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by Brett Kaiser
    So...are you saying....this should work?
    I hope that wasn't directed toward me, but nope it won't work any way that I can imagine.

    -PatP

  8. #8
    Join Date
    Dec 2002
    Posts
    1,245
    My manager swears he saw something that would allow:

    Code:
    SET funky_parameter
    GO
    
    DECLARE @x datetime
    SELECT @x = 'December 31, 1752'
    SELECT @x
    GO
    But I think (like Pat) that he was confusing this with the 2-digit year "window" which makes an educated guess when the user enters a 2-digit year as to the actual century that was intended.

    I think that the manager is smoking something, but I won't say what.

    As for the game you mentioned, you could submit it to Milton-Bradley and probably make a fortune. You might, however, run into legal and copyright issues with Scott Adams (creator of Dilbert). He seems to have cornered the market on cranially-challenged manager jokes.

    As for other platforms, I am working with a couple of instances of Oracle. One of these instances is the source of my pain. It appears that there was someone entering data about the subjects in our database back in the year A.D. 2 (as in 12/31/0002). Amazingly enough, we are also fortunate to have some clairvoyant on our staff who is able to see what the subjects in our database will be doing in the year 9992 (as in 7/4/9992).

    I was considering submitting this information to Larry Elison so that he could include it in his next marketing campaign ("timeless Oracle spans the centuries!").

    Sigh, is data validation a lost art?

    Regards,

    hmscott


    Quote Originally Posted by Brett Kaiser
    And you accused me of being no fun...

    So...are you saying....this should work?

    Code:
    DECLARE @x datetime
    SELECT @x = 'January 1, 1753'
    SELECT @x
    GO
    
    DECLARE @x datetime
    SELECT @x = 'December31, 1752'
    SELECT @x
    GO
    OK, OK, are you working on ANY other plaform instead?
    Have you hugged your backup today?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •