📜  sql try catch - SQL 代码示例

📅  最后修改于: 2022-03-11 15:04:59.985000             🧑  作者: Mango

代码示例1
BEGIN TRY
  SELECT 1 / 0 AS Error;
END TRY
BEGIN CATCH
  SELECT
    ERROR_NUMBER() AS ErrorNumber,
    ERROR_STATE() AS ErrorState,
    ERROR_SEVERITY() AS ErrorSeverity,
    ERROR_PROCEDURE() AS ErrorProcedure,
    ERROR_LINE() AS ErrorLine,
    ERROR_MESSAGE() AS ErrorMessage;
END CATCH;