473,549 Members | 2,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Jul 20 '05 #1
1 3815
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" <ja******@hotma il.com> wrote in message
news:ba******** *************** *@posting.googl e.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.

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4575
by: Darren | last post by:
Hello, I have some 'CREATE TRIGGER' definitions that work when cut/pasted into SQL*Plus worksheet and execute separately but fail with a 'trigger created with compilation errors' when executed at the same time. Neither works at all under Solaris sqlplus. Does anyone see what the problem is? create or replace trigger aut_itri
1
8968
by: Lisa Tang | last post by:
Hi, I have a table t1 with a long raw column, and I need to create a view v1 with a long raw column being a function ff1 of the long raw column in t1. And I need to update t1 with reverse function rf1 whenever there is update, insert or delete to v1. My problem is it is not allowed to refer long raw from :new or :old, so I cannot get the...
4
10218
by: SAEED BASUDAN | last post by:
Hi i have 2 Table first one : Customer with 4 Fields : cst_no,cst_name,total_Debit,tot_credit second one : Transaction with 5 Fields : Trns_no,Trns_Date,cst_no,debit,credit MY QUESTION: HOW TO CREATE TRIGGER FOR UPDATE TOT_DEBIT AND TOT_CREDIT FILEDS IN
2
6985
by: Jack | last post by:
We are have a question about the no cascade option on before triggers. The description stays that no other triggers will be fired by the changes of a before trigger. One of our developers is seeing results that would imply that other after triggers are being fired by the results of a before trigger. Is this possible? Is there some little...
2
3316
by: Net Virtual Mailing Lists | last post by:
Hello, If I have a rule like this: CREATE OR REPLACE RULE sometable_update AS ON UPDATE TO table2 DO UPDATE cache SET updated_dt=NULL WHERE tablename='sometable'; CREATE OR REPLACE RULE sometable_insert AS ON INSERT TO table2 DO UPDATE cache SET updated_dt=NULL WHERE tablename='sometable'; CREATE OR REPLACE RULE sometable_delete AS ON...
2
1540
by: rdraider | last post by:
I created and successfully tested a trigger on a test database. Now that I want to put this on a production system, the create trigger statement takes way too long to complete. I cancelled after a few minutes. The test trigger took just a second to create. The test and production databases are identical in design. Only difference is that...
8
7182
by: FM | last post by:
Hello: I want to create a trigger wich performs a write-action to a text file. I'm intending to create it with: CREATE TRIGGER TR_ALARMA_TSPRE AFTER INSERT ON T_ALARMA_TS FOR EACH STATEMENT BEGIN ATOMIC VALUES (SELECT a1,a2,a3 FROM T_TABLE >c:\TRIGGERTEST.LOG); END
3
1811
by: Andrea MF | last post by:
Hi all, i have a problem when creating a trigger on DB2 ver 7.2 on WINDOWS. I have two tables MOVIMAG and BARCODE, the trigge when INSERT INTO MOVIMAG will be UPDATE a MOVIMAG field BARCODE taken the value from the table BARCODE. I have write this but doesnt work ==========================================
0
7734
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7979
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7826
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5385
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5107
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3512
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1960
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1074
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
781
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.