0

Hi I need your help with regards on my trigger in sql server update. Want I wanted to do is to update the existing record in my database and then fire this trigger:

USE [DB004]

ALTER trigger [dbo].[trg_Updt_Item_Code] ON [DB004].[dbo].[RMIS_Item_Master_Ref]
FOR UPDATE
AS

    declare @trgDT as datetime
    declare @trgUser as varchar(20)
    declare @trgItemCode_new as varchar(50)
    declare @trgItemCode_old as varchar(50)

    set @trgDT = (select GETDATE())
    set @trgUser = (select i.EntBy from inserted i)

begin
    update RMIS_Item_Master_Ref set ItemCode =(select i.ItemCode FROM inserted i)
    where ItemCode = (select d.ItemCode FROM deleted d)
end

currently the output that i get is

(0 row(s) affected)

(1 row(s) affected)

Please help.. thanks

Edited by Reverend Jim: Moved to programming forum

1
Contributor
0
Replies
10
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.