Solved

SQL Server DTC URGENT PLEASE....

Posted on 2000-05-10
3
489 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
3 Comments
 
LVL 32

Expert Comment

by:bhess1
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Suggested Solutions

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
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…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now