呼叫从一个孩子的存储过程PRINT
原因:从嵌套存储过程PRINT导致“当前命令发生严重错误”。
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
如何使它不给一个错误?
我有一个存储过程
ALTER PROCEDURE [dbo].[Archive_SessionDeleteOnly] AS
SET XACT_ABORT ON
BEGIN DISTRIBUTED TRANSACTION
EXECUTE ASILIVE.ContosoLive.dbo.Archive_Delete
ROLLBACK TRANSACTION
PRINT 'Fargodeep Mine'
随着孩子的存储过程之中:
ALTER PROCEDURE [dbo].[Archive_Delete] AS
PRINT 'You no take candle'
当我跑我的外部程序Archive_SessionDeleteOnly
它所有运行到完成后,包括PRINT
后调用我的孩子的存储过程
You no take candle
Fargodeep Mine
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
整个操作运行完成,但我得到一个错误:如果我从删除print
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
“孩子“存储过程:
ALTER PROCEDURE [dbo].[Archive_Delete] AS
--PRINT 'You no take candle'
它运行没有错误。
我也试过随机加入NOCOUNT
(因为没有人知道如何反正修复):
ALTER PROCEDURE [dbo].[Archive_Delete] AS
SET NOCOUNT ON
PRINT 'You no take candle'
它还是引起了:
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
服务器A:SQL Server 2000中
SELECT @@version
Microsoft SQL Server 2000 - 8.00.818 (Intel X86) May 31 2003 16:08:15 Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
ServerB:SQL Server 2000
SELECT @@version
Microsoft SQL Server 2000 - 8.00.2055 (Intel X86) Dec 16 2008 19:46:53 Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
SQL Server错误日志中没有错误。
如何在子存储过程中使用PRINT
时使SQL Server不会窒息。我有其他的情况,我打电话给孩子存储过程打印,没有错误。
更新修剪到可重现性最低的情况。确切的SQL显示
我挖出了一个QA版本。你是对的。谁会认为这是SSMS中的一个错误。 –