[MSSQL]TRY…CATCH…通用格式
这一篇很简单,看代码:
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初体验
如果您喜欢该博客请点击右下角推荐按钮,您的推荐是作者创作的动力!
------------------------------------------
除非特别声明,文章均为原创,版权与博客园共有,转载请保留出处
BUY ME COFFEE