Triggers do not fire on Insert Into ....

Triggers do not fire on Insert Into ....

Post by waly » Sat, 17 Jun 2000 04:00:00



Who can help

My triggers do not fire when doing a batch insert with a store procedure
we have a:
Insert Into <Table> (column,column,..n)
         select column,column,..n from <tableName> where x = z

This would place some 5 rows in the table.
a trigger makes the PK field based on a calculation

the trigger works well when there is a single row update. with this batch
however we get the "Duplicate PKey " error.

what now?

Thanks

Walter

 
 
 

Triggers do not fire on Insert Into ....

Post by Joel Aske » Sun, 18 Jun 2000 04:00:00


Walter:

On a batch insert, are you expecting the trigger to fire once per row?

I would expect that it fires once, with the "inserted" table containing
all five rows.

Your trigger would have to take this into account.

Put a RAISERROR ... WITH LOG into your trigger
and write out the count(*) from inserted...


Quote:> Who can help

> My triggers do not fire when doing a batch insert with a store procedure
> we have a:
> Insert Into <Table> (column,column,..n)
>          select column,column,..n from <tableName> where x = z

> This would place some 5 rows in the table.
> a trigger makes the PK field based on a calculation

> the trigger works well when there is a single row update. with this batch
> however we get the "Duplicate PKey " error.

> what now?

> Thanks

> Walter