I want not to delete record from DB, but just copy it to archive table just to avoid accidents. What I found out is we can use custom stored procedure. But we cannot just add a delete stored procedure, we have to add stored procedure for select and update also. Is there any built-in or easier开发者_Go百科 way on doing that? I just need to keep the deleted records, just in case..
I'd probably go with a separate archive table, and a trigger on deletion from the regular table, something like:
CREATE TRIGGER Foo_AD
ON dbo.Foo
AFTER DELETE
AS
BEGIN
SET NOCOUNT ON;
insert Archive_Foo (a, b)
select a, b from deleted
END
GO
精彩评论