this trigger is broken in the case of inserts of multiple rows because of this line:select @card_type = (select card_type from inserted)what will be the value of @card_type if someone is inserting 1000 rows as a single transaction, all with different card types? and why store this in a variable at all? if you insist on a trigger, what you should have is this:if exists(select 1 from inserted where card_type not in ('Mastercard','Visa'))begin print 'Invalid Credit Card Type.' rollback transactionend however none of this is really necessary. this type of thing would be better implemented as a check constraint:ALTER TABLE credit_card_paymentsADD CONSTRAINT allowed_types_of_credit_cards CHECK (card_type in ('Mastercard','Visa'))
elsasoft.org