CREATE PROCEDURE spLogError AS --给应用程序返回错误的详细信息 SELECT ERROR_NUMBER() AS ErrNum, ERROR_SEVERITY() AS ErrSev, ERROR_STATE() as ErrState, ERROR_PROCEDURE() as ErrProc, ERROR_LINE() as ErrLine, ERROR_MESSAGE() as ErrMsg --将错误记入错误数据库日志 INSERT INTO SQLErrors.dbo.ErrorLog VALUES(ERROR_NUMBER(), ERROR_SEVERITY(), ERROR_STATE(), ERROR_PROCEDURE(), ERROR_LINE(),ERROR_MESSAGE()) |
BEGIN TRY |
END TRY BEGIN CATCH |
EXEC spLogError END CATCH |
欢迎光临 DIY编程器网 (http://diybcq.com/) | Powered by Discuz! X3.2 |