Solved

SQL Server DTC URGENT PLEASE....

Posted on 2000-05-10
3
496 Views
Last Modified: 2012-06-27
Hi,
I'm in a situation with two servers (SQL Server 7 ) in the same domain. I configured both servers as linked servers. I also run MSDTC on both servers. I have a trigger on the table in one DB which should update a table in the other DB on the other server. The trigger looks as follows :
CREATE TRIGGER UPDATE_SPECIE ON dbo.tbl_specie
FOR  UPDATE
AS
BEGIN
           UPDATE  vauveil.urk2000.dbo.tbl_species
           SET sp_priority=B.sp_prior, sp_niv1=B.sp_grpcode, sp_niv2=B.sp_code,
                   sp_box_content=B.sp_qubox, sp_min_amount_startprice=B.sp_minkg,
                   sp_tara=B.sp_tara, sp_percent_liquid=B.sp_nat, sp_tolerance=B.sp_tol,
                        sp_shape=B.sp_shape, sp_size=B.sp_size
           FROM vauveil.urk2000.dbo.tbl_species as c, tbl_specie AS B   WHERE c.sp_code=B.sp_code
END

When I try to update the table I receive the following error message :
OLE/DB Provider returmed message : Only one transaction can be active on this session.
Could not start a transaction for oledb provider 'SQLOLEDB'.

I looked at the settings but I don't seem to have any way that I can adjust a setting. What is going wrong? Do I need to specify that it is a distributed transaction. I tried it and replaced the begin by begin distributed transaction and the end by commit transaction but this didn't work either. I need to strat this project up tomorrow so all suggestions are welcome.
0
Comment
Question by:TomDedecker
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 32

Expert Comment

by:Brendt Hess
ID: 2798233
I'd recommend using the logical 'inserted' table:

CREATE TRIGGER UPDATE_SPECIE ON dbo.tbl_specie
FOR  UPDATE
AS
BEGIN
           UPDATE  vauveil.urk2000.dbo.tbl_species
           SET sp_priority=B.sp_prior, sp_niv1=B.sp_grpcode, sp_niv2=B.sp_code,
                  sp_box_content=B.sp_qubox, sp_min_amount_startprice=B.sp_minkg,
                   sp_tara=B.sp_tara, sp_percent_liquid=B.sp_nat, sp_tolerance=B.sp_tol,
                   sp_shape=B.sp_shape, sp_size=B.sp_size
           FROM inserted AS B
   WHERE vauveil.urk2000.dbo.tbl_species.sp_code IN (Select sp_code from inserted)

END

This will only update those that changed, and will not involve the original table at all, thus (hopefully) avoiding the problem with the transaction conflict.
0
 

Author Comment

by:TomDedecker
ID: 2799192
You' re right but this isn't a solution for our problem. Further tests hqve shown that the OLEDB transaction error isn't significant. As a matter a fact even zhen you have a syntax error in a trigger it gives the same error.
0
 

Accepted Solution

by:
bucodi earned 100 total points
ID: 2799577
We have done some tests and found the following solution:
Jo just put a COMMIT at the beginning of your trigger
CREATE TRIGGER UPDATE_SPECIE ON dbo.tbl_specie
FOR  UPDATE
AS
BEGIN
COMMIT
           UPDATE  vauveil.urk2000.dbo.tbl_species
           SET sp_priority=B.sp_prior, sp_niv1=B.sp_grpcode, sp_niv2=B.sp_code,
                  sp_box_content=B.sp_qubox, sp_min_amount_startprice=B.sp_minkg,
                   sp_tara=B.sp_tara, sp_percent_liquid=B.sp_nat, sp_tolerance=B.sp_tol,
                   sp_shape=B.sp_shape, sp_size=B.sp_size
           FROM inserted AS B
   WHERE vauveil.urk2000.dbo.tbl_species.sp_code IN (Select sp_code from inserted)

END
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Viewers will learn how the fundamental information of how to create a table.

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question