The sample code explicitly has you checking only the first value INSERTed/UPDATEd, so I'll go with that. At this point, instructors must want to keep the code simple and not have you be forced to deal with multi-row INSERTs/UPDATEs.
If you also need to verify the check digit, let me know. But that's quite a bit of code, so I'm not doing it unless it's absolutely necessay.
IF OBJECT_ID ('TriggerVIN', 'TR') IS NOT NULL DROP TRIGGER TriggerVIN; GO CREATE TRIGGER TriggerVIN ON CRM_Customers AFTER INSERT, UPDATE AS BEGIN SET NOCOUNT ON; DECLARE @aVIN varchar(30); --increase len to check for VIN being too long also DECLARE @errors varchar(1024); SELECT TOP (1) @aVIN = i.VIN FROM inserted i IF LEN(@aVIN) <> 17 BEGIN SET @errors = ISNULL(@errors + '; ', '') + 'VIN''s length is invalid because it is not 17 bytes.' END --IF IF ISNULL(SUBSTRING(@aVIN, 10, 1), '') NOT LIKE '[123456789ABCDEFGHJKLMNPRSTVWXY]' BEGIN SET @errors = ISNULL(@errors + '; ', '') + 'VIN has invalid year code value.' END --IF IF @errors > '' BEGIN RAISERROR(@errors, 16, 1) ROLLBACK TRANSACTION --optional END --IF END -- trigger definition GO