SQL Server 2005 事务级别和存储过程
如果我使用命令SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
,然后在同一上下文中使用EXECstoredProcedureName
执行存储过程,该存储过程是否会使用前面所述的事务级别或者将使用默认的?
如果我想强制每个存储过程在事务级别使用,是否必须在代码顶部包含相同的语句(SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
)?
PS:该系统构建在 .NET 2.0 和专有第三方产品之上,存在局限性,因此需要这些解决方法。
If I use the command SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
and then execute a stored procedure using the EXEC storedProcedureName
on the same context, will the stored procedure use the transaction level stated previously or will use a default one?
If I want to force every stored procedure to use on transaction level do I have to include at the top of the code the same statement (SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED
)?
PS.: the system is built on top of .NET 2.0 and proprietary third party products with limitations, hence the need of these workarounds.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
存储过程将使用调用时有效的事务隔离。
如果存储过程本身设置了显式隔离级别,则该隔离级别将在存储过程退出时重置。
(编辑:刚刚检查过,这与 BOL 所说的相反“...它仍然设置对于该连接,直到它被显式更改”,但可以从下面看到)
结果
The stored procedure will use the transaction isolation in effect when called.
If the stored procedure itself sets an explicit isolation level this will be reset when the stored procedure exits.
(Edit: Just checked and this is contrary to what BOL says "... it remains set for that connection until it is explicitly changed" but can be seen from the below)
Results