Does my stored procedure account need to cascade FK tables?

Let's say I have an Employees table (PK is the employeeID) and a sales table where the sales table has an FK column for employeeID.

Now when designing my deleteEmployee stored procedure, should I first delete rows in the Sales table, or create separate stored procedures to delete in each table and then worry about that in my business logic layer?

+1


a source to share


1 answer


No no no.

Add a field to the Employee table called "OutServiceDt" and save the date they left your company.



This way you keep a record of the sales they made, their address information and whatever else you have :)

If you are looking for employees who are on the service, filter "OutServiceDt is null".

+2


a source







All Articles