I have a small table which is filled with timing data. Please see picture for details.
The values come from an application installed on all computers. It logs certain times (logon-time, overall runtime etc...) but sometimes the values are not correct, so I need to deny writing them to the db.
I. e. the difference between EndTime and LogonTime should not exceed 40 Minutes. Any higher value is incorrect and should not be written to the db.
Note: The column TimeLogonEnd is an nvarchar-type so it is easier to calculate the difference by using EndTime - LogonTime.
The sample contains two rows. The first one is ok, the second one exceeds 40 Minutes (EndTime - LogonTime) and should not be written to db.
I thought of writing a trigger that denies the insert, but I don't have the time to search google all day on how to do it, so I'm asking for help here.