Friday, March 9, 2012

How to complete Trigger on Table

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.

No comments:

Post a Comment