Question: I am having trouble with a problem in SQL. I am supposed to apply a trigger code to every column in a Person.Person table. When

I am having trouble with a problem in SQL. I am supposed to apply a trigger code to every column in a Person.Person table. When I put the code in SQL it is full of errors. The code is

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

The table names are PersonType nchar(2), FirstName nvarchar(50) LastName nvarchar(50). How do I write the code to get rid of the errors?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!