I need to create a trigger that fires when a record is inserted in a specific table.
Having fired, the same record with a few altered fields wil be inserted to a table on a linked server.
I need help to understand the requirements to make this work.
What I have found out and configured so-far:
I have linked the remote server to the server with the trigger.
I have successfully added the trigger to the local Server
What I need to know:
How do I know the trigger is running ?
Do I have to start it manually, or will it always be active ?
How and where is it saved ?
Once saved, can it be altered ?
I apologize for the basic nature of my questions on triggers.
GrahamTo test your trigger, just insert three rows into your base table and when your statment has finished running look on your linked server to see that the rows have been added.
Once the trigger has been "compiled" it is in effect and continuously running. The only exception to this is if you BCP data into the table, by default BCP does NOT fire triggers.
A record of the trigger is placed in the sysobjects table and the text of the trigger is placed in the syscomments table.
Yes, trigger can be modified or dropped.
Books Online has an excelent write up on triggers.
Showing posts with label trigger. Show all posts
Showing posts with label trigger. Show all posts
Friday, March 9, 2012
Wednesday, March 7, 2012
How to commit a transaction even when trigger fails
I have a row that, when updated, triggers a stored procedure. However, if this stored procedure fails, the row is never updated at all.
I know with SQL 2000, you can specify on on_event argument of AFTER so that the transaction is actually "committed" before the trigger goes off, but is there a similar way to do this with SQL 7? I can't seem to find a way to have the "trigger" action take effect regardless if whatever action the trigger causes fails or not.
EdCould you issue a commit right before calling the sp?
I know with SQL 2000, you can specify on on_event argument of AFTER so that the transaction is actually "committed" before the trigger goes off, but is there a similar way to do this with SQL 7? I can't seem to find a way to have the "trigger" action take effect regardless if whatever action the trigger causes fails or not.
EdCould you issue a commit right before calling the sp?
Subscribe to:
Posts (Atom)