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:
value col1 must checked uniqueness , not null(primary key)
value col2 must checked conformity parental table(foreign key)
value col3 must checked uniqueness
value col4 must checked against check constraint
value col5 must checked not null
instead of trigger must executed
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
- instead of trigger
- checks null of pk
- checks null of column 5
- checks uniqueness of pk constraint
- checks uniqueness of unique constraint
- checks check constraint of column 4
- checks fk constraint
- fires after trigger
as far know order of 1,7, , 8 guaranteed. rest arbitrary. error stop succeeding steps.
Comments
Post a Comment