Roy Harvey
3/29/2007 7:54:00 PM
Triggers fire once for each INSERT, UPDATE or DELETE that initiates
them. An UPDATE that changes 100 rows will have 100 rows in the
inserted and deleted virtual tables. Be sure to write the triggers so
that they can handle multiple rows.
Cross database references on the same instance on the same server
require the three part object reference: dbname.schemaname.objectname.
I don't think you gain anything by using a stored procedure, in
particular because a called procedure will not have access to the
inserted and deleted virtual tables.
Roy Harvey
Beacon Falls, CT
On Thu, 29 Mar 2007 12:42:00 -0700, Rhea
<Rhea@discussions.microsoft.com> wrote:
>I am new to SQL Server, using SQL Server 2005. I am a little confused about
>when triggers fire. I am using Delphi ADO as the front end to the database.
>I use batch updates to write master/detail inserts to the database. I need
>to add a record to a table in the same database as well as a record to a
>table in another SQL Server 2005 database when a record is inserted into the
>detail table. I am trying to do this in a trigger. Will the trigger fire
>once when I do the batch update or will it fire for each row of the detail
>table individually? Also an example of how to write to a table in a second
>database from a trigger would be appreciated or should I call a stored
>procedure from the trigger to do that part? thanks.