title: T-SQL and transaction flow - from first to last
body: <p>Let's say I have table <strong>TabA</strong> with columns:</p>
  
  <ul>
  <li><p>col1 - primary key (but not identity)</p></li>
  <li><p>col2 - foreign key</p></li>
  <li><p>col3 - with unique constraint</p></li>
  <li><p>col4 - with check constraint</p></li>
  <li><p>col5 - with NOT NULL constraint</p></li>
  </ul>
  
  <p>Also, <strong>TabA</strong> has 2 triggers:</p>
  
  <ul>
  <li><p>INSTEAD OF INSERT - this one cancel insert into <strong>TabA</strong> (of course), but in it's own code insert new row into <strong>TabA</strong>. The values for all column in this new row are guaranteed correct</p></li>
  <li><p>AFTER INSERT - this one just print string</p></li>
  </ul>
  
  <p>Now, I am ready insert new row into <strong>TabA</strong> (INSERT INTO <strong>TabA</strong> VALUES(...)). Obviously, we have to expect some events:</p>
  
  <ol>
  <li><p>value for col1 must be checked for uniqueness and NOT NULL(primary key)</p></li>
  <li><p>value for col2 must be checked for conformity to the parental table(foreign key)</p></li>
  <li><p>value for col3 must be checked for uniqueness</p></li>
  <li><p>value for col4 must be checked against check constraint</p></li>
  <li><p>value for col5 must be checked for NOT NULL</p></li>
  <li><p>INSTEAD OF trigger must be executed</p></li>
  <li><p>AFTER trigger must be executed</p></li>
  </ol>
  
  <p>What I want is reorder this list(1-7) so that number 1 be on event that will happen first, 2=event that will happen second, ..., and 7 for the last event.</p>
  
  <p>Also, if event X produce error (col5=NULL, for example) - does this mean that events X+1,X+2.. will <strong>NOT</strong> happen?</p>
  
  <p>Thanks for you help!</p>