vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I created a trigger in the "source table" that will "feed" and second table. The trigger is as follows: CREATE TRIGGER [FeedToP21] ON dbo.FromUPS FOR INSERT AS Declare @Count int Select @Count = Count(*) from Inserted If @Count > 0 Begin Insert into ToP21 Select i.* From Inserted i Left Join ToP21 t on i.recnum = t.recnum Where t.recnum is null End If @@ERROR != 0 Rollback Tran A record was created in the "source table" via ODBC, however, the trigger does not seem to have fired to create the record in the second table. If I create a record manually using SQL Server Enterprise Manager within the "tableview" the trigger fires and a duplicate record is created in the second table. Is there a fix for this problem? Thank you in advance. |
| ||||
| Hi There is not enough detail to say why this is not being called and how the transactions are being handled and what data is not being written. You may want to use profiler to check the calls and possible save your commands to a sql script that can be run in Query Analyser. You could use Raiserror instead of rolling back the transaction to see if that condition is reached or to return debug information. John "Jack" <jackso95@hotmail.com> wrote in message news:ba6102e.0311131522.4c89911@posting.google.com ... > I created a trigger in the "source table" that will "feed" and second > table. The trigger is as follows: > CREATE TRIGGER [FeedToP21] ON dbo.FromUPS > FOR INSERT > AS > Declare @Count int > > Select @Count = Count(*) from Inserted > If @Count > 0 > Begin > Insert into ToP21 > Select i.* From Inserted i > Left Join ToP21 t > on i.recnum = t.recnum > Where t.recnum is null > End > > If @@ERROR != 0 > Rollback Tran > > A record was created in the "source table" via ODBC, however, the > trigger does not seem to have fired to create the record in the second > table. > If I create a record manually using SQL Server Enterprise Manager > within the "tableview" the trigger fires and a duplicate record is > created in the second table. > > Is there a fix for this problem? > > Thank you in advance. |