I need help writing a script that removes rows from a child table first and then removes rows from a primary table.
Constraint name = FK_tbAccidentParticipant_tbAccident if that even matters.
Foreign key table. Can contain 1 or many rows. (Foreign key = AccidentId)
select * FROM tbAccidentParticipant where AccidentId = 2744
Primary key table. Always 1 row. (Primary Key = Id)
SELECT * FROM [tbAccident] where Id = 2744
What I need to be able to execute is some sort of script that removes the foreign key row(s) first and then removes the 1 row from the primary table.
Transaction is optional but preferred. This would be executed in sql server mgmt studio 2012.