Would transaction work across multiple DB in the same SQL server?
If so, is this a Distributed transaction? or would basic BEGIN TRANSACTION
work?
Asked
Active
Viewed 1.8k times
39

Henry
- 32,689
- 19
- 120
- 221
3 Answers
54
A transaction across multiple DBs in the same instance is a local transaction. BEGIN TRANSACTION will work just fine.

Vlad G.
- 2,107
- 16
- 12
-
2is MSDTC service required for this kind of transaction? Will this transaction be a distributed transaciton? – Nikos Tsokos Sep 04 '15 at 11:42
-
2@Entrodus DTC is not involved. http://stackoverflow.com/questions/23976740/distributed-database-transaction-vs-cross-database-transaction – Karl Kieninger Oct 30 '15 at 13:24
-
10A small note from official documentation : A transaction within a single instance of the Database Engine that spans two or more databases is actually a distributed transaction. The instance manages the distributed transaction internally; to the user, it operates as a local >transaction.' https://technet.microsoft.com/en-us/library/ms191440(v=sql.105).aspx – Deniz Nov 15 '16 at 09:37
11
Just tested it. BEGIN TRANSACTION
works as expected across two databases on the same server.

John Tseng
- 6,262
- 2
- 27
- 35
-3
SQL Server documention is clear about how to start a distributed transaction.

Mike Sherrill 'Cat Recall'
- 91,602
- 17
- 122
- 185
-
6Distributed transaction is only required for databases in different instances, linked through linked servers. If both databases are in the same Sql Server instance, then BEGIN TRANSACTION will suffice. – harsimranb Dec 13 '16 at 22:40