Reputation: 115
I created a new trigger that would let me create a log after updating, however even though i think it should work i get the following error:
The maximum nesting level of views, stored procedures, functions or triggers was exceeded (limit: 32).
Is it possible that it has something to do with how the trigger is written?
ALTER TRIGGER [TR_Log_Notes]
ON ALUMNS
AFTER UPDATE
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Note_Text VARCHAR (30)
SET @Note_Text = 'Fields were updated'
INSERT INTO Log_Notes(Alumn_ID, Note_Text)
SELECT i.Alumn_ID, @NoteText
FROM INSERTED i
END
Upvotes: 0
Views: 571
Reputation: 1270391
You are inserting into log_notes
after updating a row in the same table. Is that really what you intend?
If you do intend the same table, then you should use a for
trigger, and update each row before it goes into the table. However, I suspect that you want to create the trigger on a different table.
Upvotes: 1