A transaction usually consists of more than 1 INSERT
or UPDATE
statements.
Depending on your requirement you must decide what happens if any of these statements violate a UNIQUE
, NOT NULL
, CHECK
or PRIMARY KEY
constraint.
Do you want the transaction to stop when the first violation occurs and rollback the changes made by the statement that caused the violation?
If the answer is yes then you must use ABORT
, which is the default behavior.
Do you want the transaction to continue with the next statement, if any of the statements violates a constraint by just ignoring and not actually executing that problematic statement?
If the answer is yes then you must use IGNORE
.