-
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
-
In SQL Server the smallest time difference you can have is 3 milli second, may be this is causing the trigger to not fire.
-
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
-
Forum Rules
|
|