sql server - T-SQL and transaction flow - from first to last -


let's have table taba columns:

  • col1 - primary key (but not identity)

  • col2 - foreign key

  • col3 - unique constraint

  • col4 - check constraint

  • col5 - not null constraint

also, taba has 2 triggers:

  • instead of insert - 1 cancel insert taba (of course), in it's own code insert new row taba. values column in new row guaranteed correct

  • after insert - 1 print string

now, ready insert new row taba (insert taba values(...)). obviously, have expect events:

  1. value col1 must checked uniqueness , not null(primary key)

  2. value col2 must checked conformity parental table(foreign key)

  3. value col3 must checked uniqueness

  4. value col4 must checked against check constraint

  5. value col5 must checked not null

  6. instead of trigger must executed

  7. after trigger must executed

what want reorder list(1-7) number 1 on event happen first, 2=event happen second, ..., , 7 last event.

also, if event x produce error (col5=null, example) - mean events x+1,x+2.. not happen?

thanks help!

this easy test setting test tables described print statements in triggers , trying insert invalid values. doing gave me

  1. instead of trigger
  2. checks null of pk
  3. checks null of column 5
  4. checks uniqueness of pk constraint
  5. checks uniqueness of unique constraint
  6. checks check constraint of column 4
  7. checks fk constraint
  8. fires after trigger

as far know order of 1,7, , 8 guaranteed. rest arbitrary. error stop succeeding steps.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -