I am findiing it hard to understand what this code is doing. Could someone please help me understand this code line by line so that I can understand what it is doing.
CREATE TRIGGER LowCredit ON Order
AFTER INSERT
AS
DECLARE @creditrating tinyint
SELECT @creditrating = v.CreditRating
FROM Customer c INNER JOIN inserted i
ON c.custID = i.custID
IF @creditrating = 5
BEGIN
RAISERROR ('This customers''s credit rating
is too low to accept new orders.’)
ROLLBACK TRANSACTION
END