View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 07:47 PM
Jack
 
Posts: n/a
Default Create trigger not firing via ODBC

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.
Reply With Quote