on-internet
← Community

Statement contains an OUTPUT clause without INTO clause error

Stack Overflow ·

I have a trigger that updates one of the inserted fields (RootId) with the value of the identity primary key (MessageId) of the same inserted record. The update should only happen when the RootId field of the inserted record is 0. The trigger looks like this: ALTER TRIGGER [dbo].[Trigger_RootIdUpdate] ON [dbo].[Messages] AFTER INSERT AS BEGIN SET NOCOUNT ON; DECLARE @MessageId Int SELECT @MessageId = I.MessageId FROM INSERTED I UPDATE Messages SET RootId = @MessageId WHERE MessageId = @MessageId AND MessageId = 0 END I use it in Azure and when I insert a row, it gives me the following error: T

Comments

Sign in or sign up to comment and upvote.

No comments yet.