Transactions

SQL Server's default behavior is to automatically commit implicit transactions. In Oracle, the default is that implicit transactions require an explicit commit. However, a linked Oracle query by default automatically commits. If you want to issue a ROLLBACK statement on a heterogeneous query, you must use an explicit distributed transaction. To roll back a linked-server query, you must explicitly declare a distributed transaction before submitting the query. First, you must set XACT_ABORT to ON. Then, you use the BEGIN DISTRIBUTED TRANSACTION statement, as the following example shows:

SET XACT_ABORT ON
BEGIN DISTRIBUTED TRANSACTION
INSERT INTO oradb..SCOTT.DEPT values
   (1,'test','example')
ROLLBACK

When you're finished, you issue either a COMMIT or ROLLBACK, just as you'd do at the end of a regular transaction.

Please or Register to post comments.

IT/Dev Connections

Las Vegas
September 30th - October 4th

Paul ThurottOur Experts will show you:
• Common SQL Server
Problems
• Best Practices for T-SQL
• SQL Server Integration
Services
• Database Development

Come See Mike Otey & Tim Ford in Person!

Early Registration Now Open

From the Blogs
May 9, 2013
blog

My ISO 8601-Compliant Signature 2

My family recently just "officially" announced that we're in the process of adopting a child from South Africa. We're quite excited, of course, but there's a ton of paperwork to do—along with the need for gobs of signatures....More
May 8, 2013
blog

Use SSIS for ETL from Hadoop

In this blog post, Mark Kromer walks you through using SSIS as a way to use ETL techniques using Microsoft's Hadoop on Windows (HDInsight) as a source using Hive connectors...More
Vision road sign
May 6, 2013
blog

Cheaters Never Win, Even in TPC Benchmarks

In this portion of the series on database benchmarking, I want to tell you about one of my favorite aspects of the TPC benchmarks – CHEATING....More
SQL Server Pro Forums

Get answers to questions, share tips, and engage with the SQL Server community in our Forums.