KB4009823 - FIX: AFTER DELETE triggers occur in the wrong order in the ON DELETE CASCADE action chain in SQL Server 2014 or 2016

Symptoms

Consider the following scenario:

  • In SQL Server 2014 or 2016, you have several tables, each of which has a PRIMARY KEY constraint specified.

  • You create a cascading chain for those tables by using the FOREIGN KEY constraint together with the ON DELETE CASCADE action.

  • You create an AFTER DELETE trigger for each table.

  • You delete a row from the parent table. This triggers the AFTER DELETE triggers and the ON DELETE CASCADE action chain.

In this scenario, the triggers may occur in the wrong order.

Resolution

This issue is fixed in the following cumulative updates for SQL Server:

Cumulative Update 5 for SQL Server 2016 RTM

Cumulative Update 2 for SQL Server 2016 SP1

Cumulative Update 5 for SQL Server 2014 SP2

Cumulative Update 11 for SQL Server 2014 Service Pack 1

 

Each new cumulative update for SQL Server contains all the hotfixes and security fixes that were included in the previous cumulative update. Check out the latest cumulative updates for SQL Server:

Latest cumulative update for SQL Server 2016

Latest cumulative updates for SQL Server 2014

StatusMicrosoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References

Cascading Referential Integrity Constraints


Learn about the terminology Microsoft uses to describe software updates.


Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

Thank you for your feedback!

Thank you for your feedback! It sounds like it might be helpful to connect you to one of our Office support agents.

×