473,394 Members | 2,168 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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 3801
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******@hotmail.com> wrote in message
news:ba************************@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.

Jul 20 '05 #2

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

Similar topics

1
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...
1
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...
4
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:...
2
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...
2
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...
2
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...
8
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...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.