Results 1 to 3 of 3

Thread: millisconds puzzle?

  1. #1
    Join Date
    Mar 2003
    Posts
    383

    millisconds puzzle?

    I wrote a trigger whenever in table A a date filed named dtPosition is changing value, it will fire to write entire record to a history table.
    The problem is when the value in millisconds change, sometimes it fires and sometimes not fire.

    ex. dtPosition value: '2003-01-21 19:05:19.000',
    update A set dtPosition = '2003-01-21 19:05:19.001' where key=1
    no firing.
    update A set dtPosition = '2003-01-21 19:05:19.002' where key=1
    if fired, but the value updated was
    '2003-01-21 19:05:19.003' instead of '2003-01-21 19:05:19.002'

    in the trigger I use the comparison of
    deleted.dtPosition <> inserted.dtPosition. It works fine at the second change level, but buzzles me not consistant on millisecond level.

    thanks for help
    David

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    In SQL Server the smallest time difference you can have is 3 milli second, may be this is causing the trigger to not fire.

  3. #3
    Join Date
    Mar 2003
    Posts
    383
    Thanks you, Shailesh Khanal:

    This answers my question exactly because it does changes and fires in 3 ms range. So, a better way might be datediff(ms, dtStart, dtEnd) > 3 will solve this ms change issue.

Posting Permissions

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