开始Tran和Commit [英] Begin Tran and Commit
问题描述
我正在写一笔交易:
开始Tran
插入测试值(10)
提交
在SQL 2016中,上面没有问题,但在SQL 2014中,我明确提到了"commit tran"。为了提交
开始Tran
插入测试值(10)
提交Tran
为什么会这样?
不应该提及"tran"。在"提交"之后不管SQL版本。你能发布你看到的错误吗?显式交易的工作方式相同,即他们需要在开始时开始并在交易结束时以
提交(或回滚)。
I am writing a transaction:
Begin Tran
insert into testing values (10)
commit
In SQL 2016 the above has no problem, but in SQL 2014 , I have explicitly mention "commit tran" in order to commit
Begin Tran
insert into testing values (10)
commit Tran
Why is that ?
There should be no need to mention "tran" after "commit" irrespective of SQL version. Can you post the error that you are seeing? Explicit transactions work the same way i.e. they need the begin at the start and commit (or rollback) at the end of the transaction.
这篇关于开始Tran和Commit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!