如何为具有更多事务的存储过程设置隔离级别

时间:2016-10-18 05:00:21

标签: sql tsql stored-procedures

我的存储过程包含6个开始和6个结束,那么如何将整个存储过程的默认REPEATABLE-READ隔离更改为READ-COMMITTED?

1 个答案:

答案 0 :(得分:0)

你可以SET session transaction isolation levels at runtime by using the tx_isolation system variable

    SELECT @@GLOBAL.tx_isolation, @@tx_isolation;
    SET GLOBAL tx_isolation='REPEATABLE-READ';
    SET SESSION tx_isolation='READ-COMMITTED';