久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

SQL Server 2005 事務級和存儲過程

SQL Server 2005 Transaction Level and Stored Procedures(SQL Server 2005 事務級和存儲過程)
本文介紹了SQL Server 2005 事務級和存儲過程的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

如果我使用命令 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED 然后在同一上下文中使用 EXEC storedProcedureName 執行存儲過程,該存儲過程是否會使用該事務之前聲明的級別還是將使用默認級別?

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?

如果我想強制每個存儲過程在事務級別使用,我是否必須在代碼頂部包含相同的語句(SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED)?

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.:該系統建立在 .NET 2.0 和專有第三方產品之上,但存在局限性,因此需要這些變通方法.

PS.: the system is built on top of .NET 2.0 and proprietary third party products with limitations, hence the need of these workarounds.

推薦答案

存儲過程將使用調用時生效的事務隔離.

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.

(剛剛檢查過,這是與 BOL 所說的相反...它保持為該連接設置,直到它被明確更改"但可以從下面看到)

( 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)

CREATE PROC CheckTransLevel
AS
DECLARE @Result varchar(20)

SELECT @Result = CASE transaction_isolation_level 
                        WHEN 0 THEN 'Unspecified' 
                        WHEN 1 THEN 'ReadUncomitted' 
                        WHEN 2 THEN 'Readcomitted' 
                        WHEN 3 THEN 'Repeatable' 
                        WHEN 4 THEN 'Serializable' 
                        WHEN 5 THEN 'Snapshot' 
                  END 
FROM sys.dm_exec_sessions 
WHERE session_id = @@SPID

PRINT @Result

GO
CREATE PROC SetRCTransLevel
AS
PRINT 'Enter: SetRCTransLevel'
SET TRANSACTION ISOLATION LEVEL READ COMMITTED
EXEC CheckTransLevel
PRINT 'Exit: SetRCTransLevel'
GO

SET NOCOUNT ON

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

EXEC CheckTransLevel

EXEC SetRCTransLevel

EXEC CheckTransLevel

結果

ReadUncomitted
Enter: SetRCTransLevel
Readcomitted
Exit: SetRCTransLevel
ReadUncomitted

這篇關于SQL Server 2005 事務級和存儲過程的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Should I call Parameters.Clear when reusing a SqlCommand with a transation?(重用帶有事務的 SqlCommand 時,我應該調用 Parameters.Clear 嗎?)
Does SqlTransaction need to have Dispose called?(SqlTransaction 是否需要調用 Dispose?)
Reason for System.Transactions.TransactionInDoubtException(System.Transactions.TransactionInDoubtException 的原因)
How do I use TransactionScope with MySql and Entity Framework? (getting Multiple simultaneous connections...are not currently supported error)(如何將 TransactionScope 與 MySql 和實體框架一起使用?(獲取多個同時連接...目前不
Why doesn#39;t TransactionScope work with Entity Framework?(為什么 TransactionScope 不適用于實體框架?)
How to dispose TransactionScope in cancelable async/await?(如何在可取消的 async/await 中處理 TransactionScope?)
主站蜘蛛池模板: 91五月天 | 日本一区二区不卡 | 国产网站在线免费观看 | 久久精品亚洲精品 | 国产精品久久久久久久久免费樱桃 | 91pron在线| 97视频精品 | 久久成人在线视频 | 国产精品日韩 | 午夜久久久久久久久久一区二区 | 日p视频免费看 | 在线免费看黄 | 一级片免费视频 | 一级看片免费视频囗交动图 | 日韩视频免费在线 | 综合网伊人 | 国产精品久久久久久久久大全 | 91九色在线观看 | 91精品国产高清一区二区三区 | 91精品国产91久久久久久最新 | 久免费视频 | 97国产精品视频人人做人人爱 | 欧美日韩精品一区二区三区四区 | 日本啊v在线 | 国产a级毛片 | 亚洲高清在线 | 91麻豆精品国产91久久久更新资源速度超快 | 狠狠艹| 成年人在线观看视频 | 日韩男人天堂 | 国产精品久久久久久久久久免费看 | 亚洲欧美日韩国产综合 | 国产精品永久 | 在线一级片 | 国产精品美女 | 午夜在线 | 日韩精品免费 | 亚洲一区二区在线免费观看 | 91国产视频在线 | 国产精品一区在线 | 亚洲精品国产偷自在线观看 |