Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

徵狀

假設您建立的存儲程式在 Microsoft SQL Server 2012 或 SQL Server 2014 中的資料表變數上使用游標。 此外,該儲存程式也會使用語句中與游標一起使用的位置 來更新資料表。例如,您的儲存程式可能如下所示:

CREATE PROCEDURE dbo.usp_TestSP AS  BEGIN  DECLARE @TableVar TABLE (SomeInt INT NULL) INSERT @TableVar VALUES (NULL)  DECLARE @curInt INT, @newInt INT SET @newInt = 1  DECLARE ccc CURSOR LOCAL FOR SELECT SomeInt FROM @TableVar WHERE SomeInt IS NULL  OPEN ccc  FETCH NEXT FROM ccc INTO @curInt UPDATE @TableVar SET SomeInt = @newInt WHERE CURRENT OF cccCLOSE ccc  SELECT * FROM @TableVar END 

當您使用 sp_refreshsqlmodule 系統存儲程式執行您的儲存程式時,可能會發生存取衝突,而且您可能會收到類似以下的錯誤訊息:

Msg 596、Level 21、State 1Cannot 會繼續執行,因為會話處於 kill 狀態。消息0、等級20、狀態0A 在目前命令上發生嚴重錯誤。 結果(如果有的話)應該捨棄。

在這種情況下,類似下列的錯誤也會寫入 SQL Server 錯誤記錄:

日期時間. 730 spid51 SqlDumpExceptionHandler:程式51產生了致命的例外 c0000005,EXCEPTION_ACCESS_VIOLATION。 SQL Server is terminating this process.date time.730 spid51 * *******************************************************************************date time.730 spid51 *date time.730 spid51 * BEGIN STACK DUMP:date time.730 spid51 * date time spid 51date time.730 spid51 *date time.730 spid51 *date time.730 spid51 * Exception Address = 00007FFC270236D5 Module(sqllang+00000000005036D5)date time.730 spid51 * Exception Code = c0000005 EXCEPTION_ACCESS_VIOLATIONdate time.730 spid51 * Access Violation occurred reading address 0000006F00620074date time.730 spid51 * Input Buffer 136 bytes -date time.730 spid51 * EXECUTE sp_refreshsqlmodule N'[dbo].[usp_TestSP] 「日期時間. 730 spid51 * 日期時間. 730 spid51 *

解決方案

累積更新資訊

此問題已于下列更新中修正:

每個新的 SQL Server 累計更新都包含所有的修正程式,以及前一個累積更新中所包含的所有安全性修正程式。 查看 SQL Server 的最新累計更新:

狀態

Microsoft 已確認<適用於>一節中所列的 Microsoft 產品確實有上述問題。

參考

瞭解 Microsoft 用於描述軟體更新的 詞彙

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×