I am working on a stored procedure that performs some operations on class students
At the last stage, he updates the status of some students according to some criteria.
Everything is pretty straight forward, but I have a dilemma. Basically, there is an existing sp in a system called
pUpdateStudentStatus(studentID, statusID, comments, userID)
This sp is used every time the status of one user is updated. In addition to updating status, it also logs changes to the StudentStatusHistory table.
So here is my dilemma,
- If I want to use this stored procedure, I need a loop through the records (either using the cursor, or by writing a loop)
- If I want all operations to be set based, I need to copy the logic from pUpdateStudentStatus (which may change in the future)
Are there any other options? Which one would you choose?
I believe that an alternative approach with an update trigger is not a way, because I need additional data, such as the userId of the user who changed the status, and comments
I am using SqlServer2005
sql sql-server
kristof
source share