This is the way I do this:
Tables:
Departments
Departments_to_ employees
Employees
Add employee function:
-Lock employee table
-Insert employee
-Search for last employee record to find newly added employee ID
-Unlock employee table
-Insert employee id and department id into Departments_to_ employees table
There has got to be a better way of doing this. Is using stored procedures the only way?
Tables:
Departments
Departments_to_ employees
Employees
Add employee function:
-Lock employee table
-Insert employee
-Search for last employee record to find newly added employee ID
-Unlock employee table
-Insert employee id and department id into Departments_to_ employees table
There has got to be a better way of doing this. Is using stored procedures the only way?
Comment