I have a table AT_OBJECT with two TIMESTAMP nullable fields MODIFIED and CURR_MODIFIED. I need to compare them but milliseconds should not be counted. As of now I use SQL request:
SELECT
*
FROM
at_object o
WHERE
DATEDIFF(SECOND,
COALESCE(o.modified, cast('01.01.2000 00:00:00.0000' as TIMESTAMP)),
COALESCE(o.curr_modified, cast('01.01.2000 00:00:00.0000' as TIMESTAMP))) > 0
It works but looks kind of ugly. Is there a better way to compare timestamps without milliseconds?