Using SQL Server 2000, I need to insert the deleted records from one table into a second table.
What's the best way to achieve this using a SQL Server 2000 trigger?
with thanks and regards
Sathia
Using SQL Server 2000, I need to insert the deleted records from one table into a second table.
What's the best way to achieve this using a SQL Server 2000 trigger?
with thanks and regards
Sathia
Consider this delete trigger:
CREATE TRIGGER trig_delCustomer
ON Customer --the table being deleted from
FOR DELETE
AS
DECLARE @isOnContract BIT
--insert all the effected rows (the ones being deleted) into this other table.
INSERT INTO
MyOtherTable (ID, CustomerName, Email, Phone)
SELECT
ID, [Name], Email, Phone
FROM Deleted