Hi iam trying to make an update trigger in my database. But i get this error every time the triggers trigs.
Error MEssage: The row value(s) updated or deleted either do not make the row unique or they alter multiple rows(3rows)
and heres my trigger
ALTER TRIGGER [dbo].[x1pk_qp_update]
ON [dbo].[x1pk] FOR UPDATE
AS
BEGIN TRY
DECLARE @UserId int
, @PackareKod int
, @PersSign varchar(10)
SELECT @PackareKod = q_packarekod
, @PersSign = q_perssign
FROM INSERTED
IF @PersSign IS NOT NULL
BEGIN
IF EXISTS (SELECT * FROM [QPMardskog].[dbo].[UserAccount] WHERE [Account] = @PackareKod)
BEGIN
SET @UserId = (SELECT [UserId]
FROM [QPMardskog].[dbo].[UserAccount]
WHERE [Account] = @PackareKod)
UPDATE [QPMardskog].[dbo].[UserAccount]
SET [Active] = 1
WHERE [Account] = @PackareKod
UPDATE [QPMardskog].[dbo].[User]
SET [Active] = 1
WHERE [Id] = @UserId
END
END
END TRY
But i only update one row in the table how can it says 3 rows. Please advise.