码迷,mamicode.com
首页 > 数据库 > 详细

Sql Server异常捕获 try catch

时间:2015-10-12 22:22:53      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

declare @num int
begin try
set @num=1/0
end try

begin catch
select ERROR_LINE() as 错误行数, ERROR_MESSAGE() as 错误消息
end catch

 

运行截图:

技术分享

Sql Server异常捕获 try catch

标签:

原文地址:http://www.cnblogs.com/527289276qq/p/4872775.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!