Executing a trigger before SQL Server table is updated
Can I execute a trigger before an insert is created to a table. I need to create logging on the CRM system, but I do not have access to modify the CRM. Can I grab incoming values from the table and based on the ID, read and extract with a trigger before the table is updated?
You can, by creating an INSTEAD OF TRIGGER. However, I suspect you're really asking about an UPDATE trigger (by your description). Even AFTER triggers (ie the default type) allow you access to both the before and after versions of the data via the deleted and inserted virtual tables.
Check out this helpful tip: |
|
Optimize database triggers in SQL Server 2000
It's hard to follow the logic behind triggers and easy to forget about them in time. Why and when should you use them? Learn about performance issues and design considerations.
|
This was first published in September 2007
Join the conversationComment
Share
Comments
Results
Contribute to the conversation