Question: Alter and apply the trigger code. Use AdventureWorks Apply the trigger code provided below to each column of the Person.Person table to track the number
Alter and apply the trigger code. Use AdventureWorks
Apply the trigger code provided below to each column of the "Person.Person" table to track the number of modifications of data for each column in the table.
Trigger Code:
CREATE TRIGGER [TRIGGER_ALTER_COUNT] ON [dbo].[tblTriggerExample]
FOR INSERT, UPDATE
AS
BEGIN
DECLARE @TransID VARCHAR(36)
SELECT @TransID = TransactionID FROM INSERTED
UPDATE [dbo].[tblTriggerExample] SET AlterCount = AlterCount + 1
,LastUpdate = GETDATE()
WHERE TransactionID = @TransID
END
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
