I think you stated it pretty clearly yourself.Have you tried to test this? How about this:In all cases the instead of insert fired first without any violations, the instead of insert was not fired (again) when the actual insert occured, and the after insert didn't fired when constraints were violated during the actual insert.use tempdbgocreate table junk (i int primary key clustered, c char(1) check(c = 'c'))gocreate trigger tr_junk_inI on junk instead of insertasbegin print 'instead of insert' insert junk (i, c) select i, c from insertedendgocreate trigger tr_junk_aI on Junk after insertasbegin print 'after insert'endgoprint 'insert 1'insert junk (i, c) values (1, 'c')goprint ' 'print ' 'print 'insert 2'insert junk (i, c) values (2, 'd')goprint ' 'print ' 'print 'insert 3'insert junk (i, c) values (1, 'c')godrop table junkOUTPUT:insert 1instead of insertafter insert(1 row(s) affected)(1 row(s) affected) insert 2instead of insertMsg 547, Level 16, State 0, Procedure tr_junk_inI, Line 5The INSERT statement conflicted with the CHECK constraint "CK__junk__c__42CCE065". The conflict occurred in database "tempdb", table "dbo.junk", column 'c'.The statement has been terminated. insert 3instead of insertMsg 2627, Level 14, State 1, Procedure tr_junk_inI, Line 5Violation of PRIMARY KEY constraint 'PK__junk__41D8BC2C'. Cannot insert duplicate key in object 'dbo.junk'.The statement has been terminated.
Be One with the OptimizerTG