这一篇很简单,看代码:
USE Dorben
GO
BEGIN TRY
-- Generate a divide-by-zero error.
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
猜测您可能对下边的文章感兴趣
[MSSQL]GROUPING SETS,ROLLUP,CUBE初体验
如果您喜欢该博客请点击右下角推荐按钮,您的推荐是作者创作的动力!