SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Triggers
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shinelawrence
Starting Member

India
32 Posts

Posted - 04/19/2013 :  01:27:44  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2206 Posts

Posted - 04/19/2013 :  01:34:38  Show Profile  Reply with Quote
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

India
32 Posts

Posted - 04/19/2013 :  01:58:56  Show Profile  Reply with Quote
thanks for ur kindly reply.... It's working

Lawce
Go to Top of Page

bandi
Flowing Fount of Yak Knowledge

India
2206 Posts

Posted - 04/19/2013 :  02:30:10  Show Profile  Reply with Quote
quote:
Originally posted by shinelawrence

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


Welcome

--
Chandu
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000