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?

There's a massive amount of tutorials out there that cover what you need to do.

Have a look at these links to:

Insert new record.

Update an existing record.

Delete and existing record.

In the future you need to show us what you have done so we know you have attempted it yourself because the DaniWeb rules state that we can't do you're work for you but only help you and give you advice.

Good luck and let me know if you get stuck.

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.

Hi All !

I have no any idea about stored procedure ;

regards
prem