开发者

SQL Server 2000 Triggers

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜