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
 General SQL Server Forums
 New to SQL Server Programming
 before trigger

Author  Topic 

anand.mind
Starting Member

4 Posts

Posted - 2008-04-20 : 09:19:48
Sir,
How can I fire a trigger before a DML operation. For example, I want to store the old records of a table in another table before inserting the new rows in that table.
Please guide me.



Regards,
Anand

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2008-04-20 : 09:29:34
Table auditing?

http://sqlserver2000.databases.aspfaq.com/how-do-i-audit-changes-to-sql-server-data.html
http://www.nigelrivett.net/AuditTrailTrigger.html


Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-20 : 13:27:56
You can have two types of DML triggers. After & Instead of . I think for the above scenario you need a INSTEAD OF trigger which before each insert action fires and inside which you can write code to store old records to another table.
Go to Top of Page
   

- Advertisement -