db2 audit field - ghdrako/doc_snipets GitHub Wiki
special column that tracks changes to each row automatically
alter table <table_name> add column <field_name> TIMESTAMP NOT NULL IMPLICITLY HIDDEN FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP;
Pole aktualizowane przez wewnetrzne mechanizmy db2 przy aktualizacji rekordu. HIDDEN
powoduje ze w select *
sie nie pokazuje
This defines a special column with the following characteristics:
- `TIMESTAMP NOT NULL'
- The column stores a
TIMESTAMP
. - It cannot be null.
- The column stores a
-
IMPLICITLY HIDDEN
- The column is not visible in standard SELECT * queries.
- You can access it explicitly if needed, but it's "hidden" by default.
-
FOR EACH ROW ON UPDATE AS ROW CHANGE TIMESTAMP
- This makes the column automatically update with the current timestamp every time the row is updated.
- It helps track the last modification time of each row—useful for auditing, replication, or change data capture (CDC).