TR_BANKACCOUNTAUTHORIZEDSIGNATURE_UPDATE

Definition

Copy


        CREATE trigger [dbo].[TR_BANKACCOUNTAUTHORIZEDSIGNATURE_UPDATE] on [dbo].[BANKACCOUNTAUTHORIZEDSIGNATURE] for update not for replication as
        begin
            set nocount on                
            begin try
                if exists (select * from DELETED D 
                    full outer join INSERTED I on D.ID = I.ID
                    join dbo.DISBURSEMENTPROCESSTEMPLATE B ON D.ID = B.SIGNATURE1ID
                    where D.AUTOSIGNATURECODE = 1  and  I.AUTOSIGNATURECODE = 0)
                or exists
                    (select * from DELETED D 
                    full outer join INSERTED I on D.ID = I.ID
                    join dbo.DISBURSEMENTPROCESSTEMPLATE B ON D.ID = B.SIGNATURE2ID
                    where D.AUTOSIGNATURECODE = 1  and  I.AUTOSIGNATURECODE = 0)
                begin
                    raiserror('This auto-signature is in use and cannot be changed to Allow manual signatures only.', 13, 1);
                end
            end try
            begin catch
                exec dbo.USP_RAISE_ERROR;
            end catch            
        end