Let's say I have a TabA table with columns:
col1 - primary key (but not identifier)
col2 - foreign key
col3 - with unique constraint
col4 - with control limit
col5 - with NOT NULL constraint
In addition, TabA has 2 triggers:
INSTEAD OF INSERT - this is the one to insert into TabA (of course), but in it own code inserts a new line into TabA . Values ββfor all columns in this new row are guaranteed to be correct.
AFTER INSERT - it's just printing a line
Now I am ready to insert a new line into TabA (INSERT INTO TabA VALUES (...)). Obviously, we should expect some events:
the value for col1 must be checked for uniqueness and NOT NULL (primary key)
the value for col2 must be checked against the parent table (foreign key)
Col3 value must be checked for uniqueness
Value for col4 should be checked for check constraint
value for col5 should be checked for NOT NULL
INSTEAD OF trigger must be executed
AFTER trigger trigger
I want to reorder this list (1-7) so that the number 1 is in the event that will happen first, 2 = the event that will happen second, ... and 7 for the last event.
In addition, if event X causes an error (for example, col5 = NULL) - does this mean that events X + 1, X + 2 .. will NOT ?
Thanks for the help!
sql sql-server tsql transactions
Smarty
source share