开发者

SQL Server 2000 Triggers

开发者 https://www.devze.com 2022-12-13 03:16 出处:网络
Using SQL Server 2000, I need to insert the deleted records from one t开发者_C百科able into a second table.

Using SQL Server 2000, I need to insert the deleted records from one t开发者_C百科able 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
0

精彩评论

暂无评论...
验证码 换一张
取 消