TRY CATCH with Linked Server in SQL Server 2005 Not Working

杀马特。学长 韩版系。学妹 提交于 2019-12-01 20:55:29

See Handling Errors in Server-to-Server Remote Stored Procedures:

Calling RAISERROR with severity less than 20 from inside a remote stored procedure causes a statement abort error on the remote server. A TRY…CATCH construct on the local server handles remote batch abort errors only. If a remote stored procedure calls RAISERROR with severity less than 20 and the remote stored procedure is scoped within a TRY block on the local server, RAISERROR does not cause control to pass to the CATCH block of the TRY…CATCH construct. However, RAISERROR with severity 20 or greater on the remote server breaks the connection, and execution on the local server passes to the CATCH block.

pblack

This returns the error information locally:

EXEC ('your.fullyqualified.storedprocname') AT YOUR_LINKED_SERVER;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!