Henry
Henry

Reputation: 32905

Would transaction work across multiple DB in the same SQL server? If so, is this a Distributed transaction?

Would transaction work across multiple DB in the same SQL server? If so, is this a Distributed transaction? or would basic BEGIN TRANSACTION work?

Upvotes: 41

Views: 21198

Answers (3)

Vlad G.
Vlad G.

Reputation: 2147

A transaction across multiple DBs in the same instance is a local transaction. BEGIN TRANSACTION will work just fine.

Upvotes: 57

SQL Server documention is clear about how to start a distributed transaction.

BEGIN DISTRIBUTED TRANSACTION

Upvotes: -3

John Tseng
John Tseng

Reputation: 6352

Just tested it. BEGIN TRANSACTION works as expected across two databases on the same server.

Upvotes: 13

Related Questions