Sql Server异常捕获 try catch

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

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

 

运行截图:

posted @ 2015-10-12 20:45  秋刀鱼No1  阅读(679)  评论(0编辑  收藏  举报