Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Triggers

Author  Topic 

shinelawrence
Starting Member

32 Posts

Posted - 2013-04-19 : 01:27:44
Hi Everyone,
I have one employee details table. If i delete US country employee details. Then that particular records only insert in another table using trigger. How to do.. Please tell me...

Thanks In Advanced

Lawce

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-19 : 01:34:38
CREATE TRIGGER UDT_DeleteTrigger
ON Employees
FOR DELETE
AS
BEGIN
INSERT INTO Emp_History
SELECT * FROM deleted -- deleted is a virtual table that holds deleted records of original table
END

--
Chandu
Go to Top of Page

shinelawrence
Starting Member

32 Posts

Posted - 2013-04-19 : 01:58:56
thanks for ur kindly reply.... It's working

Lawce
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-04-19 : 02:30:10
quote:
Originally posted by shinelawrence

thanks for ur kindly reply.... It's working
Lawce


Welcome

--
Chandu
Go to Top of Page
   

- Advertisement -