Hello,
Yes, you can create a trigger like this:
CREATE TRIGGER KeepUpdated on MyTable FOR UPDATE, INSERT AS
BEGIN
if not update(MyLastModificationTime) [i]--NOT updated from client application[/i]
BEGIN
update MyTable
set
MyLastModificationTime= CURRENT_TIMESTAMP
from
MyTable inner join inserted i on (
MyTable.MyPrimaryKey = i.MyPrimaryKey
END
END
You can change the "if not update(MyLastModificationTime)" to
if (select APP_NAME () <> 'GeniusConnect'):
this version will update the MyLastModificationTime for all other process, except updates from GeniusConnect sync.
If you are using replication, you can also add:
"not for replication" to avoid changes during the replication process.
This example is based on SQL Server, but the idea is the same for any DB with trigger support.