I want to add an update trigger on Leases table, everytime anything changes on leases table I would like add this to Audits Table, This will add new Audit every time, I need to store this fields in the Audtits table when the changes were made, what fields were affected, and what their old and new values were. I want to do it using T-SQL.
Leases
[Id] INT NOT NULL PRIMARY KEY, [date_of_contract] DATE NULL, [first_payment_date] DATE NULL, [amt_monthly_pay] MONEY NULL, [number_monthly_pay] FLOAT NULL, [vehicle_id] INT NULL, [customer_id] INT NULL, [leaseTerms_id] INT NULL, Audits
[Id] INT NOT NULL PRIMARY KEY, [date_of_change] DATE NULL, [the_changed_field] TINYINT NULL, [old_value] NCHAR(20) NULL, [new_value] NCHAR(20) NULL, [lease_id] INT NULL, https://stackoverflow.com/questions/66739135/update-trigger-on-the-leases-table March 22, 2021 at 09:01AM
没有评论:
发表评论