为什么 SET XACT_ABORT ON 不是默认行为? [英] Why isn't SET XACT_ABORT ON the default behavior?

查看:19
本文介绍了为什么 SET XACT_ABORT ON 不是默认行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

阅读这样的内容 在 Dan Guzman 的博客上发布,我想知道:为什么 SET XACT_ABORT ON 不是默认行为?是否存在它有害的情况,或者SET XACT_ABORT OFF 更不理想/效率低下?

Reading things like this post on Dan Guzman's blog, I wonder: why isn't SET XACT_ABORT ON the default behavior? Is there a case where it's harmful, or much less desirable/efficient than SET XACT_ABORT OFF?

推荐答案

这是对错误的自动响应,如果您能够处理错误并从中恢复,则更可取.如果事务自动回滚,那么您就没有这个机会.

It's an automatic response to an error, it's more desirable if you can handle the error and recover from it. If the transaction automatically rolls back then you don't get this opportunity.

Dan 在他的博客中提到的问题是由于客户端中止而出现的,在 SQL 中这种中止不存在.因此,在 SQL 中,默认情况下不会自动中止事务.

The problem Dan mentions in his blog arises because of the abort from the client, within SQL this abort doesn't exist. Hence within SQL the default is not to automatically abort transactions.

这篇关于为什么 SET XACT_ABORT ON 不是默认行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆