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

相关文章:

  • 2021-10-09
  • 2021-09-18
  • 2021-10-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
相关资源
相似解决方案