• webrunner (3/4/2009)


    ***********SPOILER ALERT***********

    john.arnott (3/3/2009)


    For one additional degree of difficulty: What's the result from this query?

    select DATEADD(HOUR,5,DATEADD(MINUTE,-59,'2009-02-09 12:34:56.789'))

    a) 2009-02-09 07:34:57.789

    b) 2009-02-09 16:35:56.789

    c) 2009-02-09 16:33:56.790

    d) 2009-02-09 16:35:56.790

    I'm going to go with:

    b) 2009-02-09 16:35:56.789

    UPDATE: I ran the result and got c) 2009-02-09 16:33:56.790. (My original second choice.) Why do the milliseconds get rounded up?

    Thanks,

    webrunner

    It's the limit of the precision in ms. If the last digit is not a possible value, it gets rounded up or down depending on the closest number.