Datetime seconds are rounded up in case it has 999 milliseconds

Answered Datetime seconds are rounded up in case it has 999 milliseconds

  • 10 สิงหาคม 2555 8:25
     
     

    Hi,

    I use SqlCE 3.5 and found interesting behavior. All Datetime value which has 999 milliseconds are rounded up. Any clue why? (998 ms is fine)

    CREATE TABLE Test(  
     [CompleteTime] datetime NOT NULL
    )
    GO
    INSERT INTO Test SELECT '2009-04-03 15:41:27.999'
    GO
    SELECT * FROM Test
    GO
    DROP TABLE Test

    SqlCE 4.0 has same behavior.

    • แก้ไขโดย ET__ 10 สิงหาคม 2555 8:39
    •  

ตอบทั้งหมด

  • 10 สิงหาคม 2555 8:36
     
     คำตอบ

    Hello,

    That's quite normal and well documented, see Data Types => datetime

    datetime stores only .000, .003 and .007 values, all others are rounded.


    Olaf Helper
    * cogito ergo sum * errare humanum est * quote erat demonstrandum *
    Wenn ich denke, ist das ein Fehler und das beweise ich täglich
    Blog Xing

    • ทำเครื่องหมายเป็นคำตอบโดย ET__ 10 สิงหาคม 2555 8:41
    •