Would transaction work across multiple DB in the s

2019-04-03 14:16发布

问题:

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

回答1:

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



回答2:

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



回答3:

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

BEGIN DISTRIBUTED TRANSACTION