![]() |
---|
create trigger [dbo].[TR_BANKACCOUNTTRANSACTION_EXT_VALIDATION_I] on [dbo].BANKACCOUNTTRANSACTION_EXT after insert not for replication as begin set nocount on; declare @AccountID uniqueidentifier; select @AccountID=BANKACCOUNTID from inserted; if not exists(select ID from [dbo].BANKACCOUNT A where A.ID=@AccountID and A.STATUSCODE=1) begin raiserror ('Transactions cannot be added to closed bank accounts.', 16, 1); rollback transaction; end; end; |