Home All Groups Group Topic Archive Search About
Author
8 Sep 2006 6:01 PM
Rob
We are currently having the following process finger-pointing  issue...

Assume you have the following situation...

An Orders table
A Shipments table
An Invoice table

A separate program takes Orders information and Inserts rows into the
Shipments table (at time of shipping)

When rows are inserted into the Shipments table via "the Shiping Process", a
trigger "for Invoicing" is fired.

Currently, it appears that some random rows are "missing" from the Shipment
table after the shipping process occurs.

There are at least 2 distinct possibilities...

1. The Shipping process failed to insert the row

or

2. The trigger failed, and thus the underlying action (writing the shipment
record) fails as well.

Is there any way to construct (or error trap) the trigger, such that the
underlying row gets written to the Shipments table (even if the subsequest
actions fail) ?  Also, how to log the failure ?

Author
8 Sep 2006 10:47 PM
Erland Sommarskog
Rob (rwch***@comcast.net) writes:
Show quote
> A separate program takes Orders information and Inserts rows into the
> Shipments table (at time of shipping)
>
> When rows are inserted into the Shipments table via "the Shiping
> Process", a trigger "for Invoicing" is fired.
>
> Currently, it appears that some random rows are "missing" from the
> Shipment table after the shipping process occurs.
>
> There are at least 2 distinct possibilities...
>
> 1. The Shipping process failed to insert the row
>
> or
>
> 2. The trigger failed, and thus the underlying action (writing the
> shipment record) fails as well.

I've been trying to understand this, and may be that it's the end of a
working week and time for bed, but I can't really get it together.

As I understand it, you first insert rows into Shipments, and then
the trigger on Shipments inserts rows into Invoices (or updates).

Then you say the rows in Shipments are missing. Is the action in
Invoices also missing? Or is that one carried out? Or have I gotten
it all wrong?

If "fails" here refers to an execution error, there should be an
error message somewhere which can give you more information.


--
Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

AddThis Social Bookmark Button