jeffersonalomia -3 Junior Poster

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.