What are the Actions Performed By SQL Server?

What are the Actions Performed By SQL Server?

Last updated:10/28/2020 12:18:51 AM

1 Answers

Rahul Roi
Rahul Roi

So here, we are providing some following options while working with Cascading Referential Integrity Constraints

SET NULL:

When a user tries to remove or update any statement(s) that will affect rows in the foreign key table, then those values will be set to NULL when the PrimaryKey's record is removed or updated in the PrimaryKey table. Here, the important thing that we need to keep in mind that the foreign key columns affected must allow NULL values.

CASCADE:

When a user wants to remove the statement(s) which will affect the rows in the foreign key table, then those rows will be deleted when the primary key record is deleted.
Like that, If an update statement affects rows in the foreign key table, then those rows will be updated with the value from the primary key record after it has been updated.

SET DEFAULT:

Whenever a delete or update statement affects rows in a foreign key table, then all rows containing those foreign keys are set to the default value. And Each foreign key column in the related table must have default constraints defined on them.

NO ACTION:

It is the default action that SQL Server performs. It specifies that if an update or deletes statement affects rows in foreign key tables, then the action will be denied and rolled back. An error message will be raised.

Answer