views:

573

answers:

1

I have a SQL Insert query inside a stored proc, for inserting rows into a linked server table.

Since the stored proc is getting called within a parent transaction, this Insert statement tries to use a DTC for inserting rows into the linked server.

I would like to avoid DTC from getting involved.

Is there any way I can do that (like a hint) for the Insert SQL statement to ignore transactional scope?

+3  A: 

My suggestion is that you store whatever you want to insert into a staging table, and once the procedure is over run the cross server insert. To my knowledge there is no way of ignoring the transaction you are in once you are within the SProc execution.

In contrast, if you use .NET 2.0's System.Transaction namespace, you can tell specific statements not to participate in any parent scope transaction. This would require you to write some of your logic in code rather than stored procedures, but would work.

Here's a relevant link.

Good luck, Alan.

AlanR
Thanks Alan. Looks like my only option is to enable DTC for the server without rewriting the code.
Gulzar