|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Trigger testingAssume 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 ? Rob (rwch***@comcast.net) writes:
Show quote > A separate program takes Orders information and Inserts rows into the I've been trying to understand this, and may be that it's the end of a> 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. 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 |
|||||||||||||||||||||||