简体   繁体   中英

Delete rows from two tables atomically in SQL Server?

How do I delete rows from different tables atomically?

Table A has a primary key and foreign key into Table B.

The standard solution is to use ON DELETE CASCADE for your constraint. Search for 'cascade' on that page.

If that is not an option, this SO question may interest you: In SQL Server 2005, can I do a cascade delete without setting the property on my tables?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM