March 25, 2006 at 12:57 am
I am setting system which has alot of procedures in it. one of the procedures is to be able to cupture all deleted records into a re-cycle bin table where the record can always be recovered. has any member ever writen such a code which i can be able to set as my basis as a stored procedure.
Thanks, Allan.
March 25, 2006 at 4:31 pm
use a trigger instead...
/*some_master_table_hist has same structure as some_master_table except for a date field
*/
create trigger tr_delete_example
on some_master_table
after delete
as
begin
insert some_msater_table_hist
select *,getdate()
from deleted
end
Mathew J Kulangara
sqladventures.blogspot.com
March 27, 2006 at 8:14 am
An alternative method is to maintain a logically deleted flag on the record and use an INSTEAD OF trigger to flag the record as deleted. You can then use this to allow end user apps to see and undelte the deleted records.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply