不工作,如果我嘗試運行在SQL Server 2005下面的代碼我得到錯誤嘗試捕捉在SQL Server 2005
BEGIN TRY
SELECT 1/0;
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() AS ErrorNumber
,ERROR_SEVERITY() AS ErrorSeverity
,ERROR_STATE() AS ErrorState
,ERROR_PROCEDURE() AS ErrorProcedure
,ERROR_LINE() AS ErrorLine
,ERROR_MESSAGE() AS ErrorMessage;
END CATCH;
GO
錯誤:
Line 1: Incorrect syntax near 'TRY'.
Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'END'.
Msg 195, Level 15, State 10, Line 7
'ERROR_NUMBER' is not a recognized function name.
我使用SQL Server 2000服務管理器,但現在我已經安裝了SQL Server 2005服務管理器,但仍然得到錯誤..一篇文章相關說
這樣的錯誤的原因似乎是目標達tabase在MS SQL Server 2000服務器上運行。所以請確保你的數據庫服務器是SQL2005
這是什麼意思..?我要做什麼變化?
@ken ...嘗試捕獲不存在於SQL Server 2000中,所以這不是我的問題...我的嘗試捕獲不工作在SQL Server 2005本身我希望你清除現在... thanx – anay 2009-11-27 20:07:55
@ ken ..在開始自己我高壓指定即時通訊編寫此代碼在SQL Server 2005 ..我希望你注意到... – anay 2009-11-27 20:29:42