How to update the time of each row and check if its updated or not Name
Time
Status




T1
9/12/2020 12:12:09
expected


T2
8/06/2020 11:09:12
expected




These are table name and updated time in the DB I want to get the status and time of updation of specific tables .Set the status as &quot;expected&quot; for tables where updation happening daily and &quot;not expected&quot; when when updation miss out daily
Maybe you need in
CREATE TRIGGER tr_bu_check_gap
BEFORE UPDATE
ON {tablename}
FOR EACH ROW
SET NEW.Status = CASE WHEN DATEDIFF(NEW.Time, OLD.Time) &gt; 1
                      THEN 'not expected'
                      ELSE 'expected'
                      END;

?
PS. This is solution for MySQL only. For SQL Server it can be similar, but syntax adaptation needed.