I have a table named Machines with fields: MACHINEID, MACHINEName MACHINECode, FACILITY where MACHINEID is a primary key. And i like to create a general stored procedure that does ADD, EDIT and DELETE operations and after updating i want the old record to be kept. How can i do that?

5 Years
Discussion Span
Last Post by pssingh1001

Instead of a stored procedure, why not use a trigger to keep a track of the changes? It will be a lot easier to track updates and you get access to DELETED and INSERTED.
You can still use the sproc, to do the operations and let the logging to the trigger.


In deletion part, what I did before was to add a column status on my db, when i delete a record it will add the word 'Deleted" on its status part. The SQL statement in showing records includes where statement with the condition status is NULL, this way those the user thought deleted records are really deleted but inside the database they are present.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.