This is a simple Trigger on the table named -BranchAllotmentDetail , this trigger was fired when the column named ' IsReAllocated ' -is updated.
We get access the values of same Row where the trigger is fired,. here BranchID & BranchAllotID .
alter TRIGGER trgAfterUpdateBranchAllotmentDetail ON [dbo].[BranchAllotmentDetail]
FOR UPDATE
AS
declare @BranchID int;
declare @BranchAllotID int;
select @BranchID=i.BranchID from inserted i;
select @BranchAllotID=i.BranchAllotID from inserted i;
--select @empsal=i.Emp_Sal from inserted i;
if update(IsReAllocated)
begin
update BranchAllotmentDetail set IsActiveSeries=1
where BranchID=@BranchID
and BranchAllotID=@BranchAllotID
end
GO

0 comments:
Post a Comment