I'm using Employee
, City
, EmpSalary
, EmpOrganization
, Salcomponents
tables in my database where Employee
table CityID
column references CityID
of City
table, and reporting ID column self references EmpID
of Employee
table
Empsalary
tableempId
referencesEmployee.EmpId
EmpOrganization
tableempid
referencesEmployee.EmpId
I want to design a stored procedure with CityId
as input to delete data from Employee
, Empsalary
, Emporganization
simultaneously
Please suggest how to proceed further?
1条答案
按热度按时间lkaoscv71#
You don't need a stored proceudre. You can design your foregin key constraints that they cascade the delete:
This will delete the entry in the City table when the Employee entry is deleted.