SQL try

BEGIN TRY
-- Generate a constraint violation error.
DELETE FROM Production.Product
WHERE ProductID = 980;
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; IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION;
END CATCH; IF @@TRANCOUNT > 0
COMMIT TRANSACTION;
GO
上一篇:jQuery延迟加载(懒加载)插件 – jquery.lazyload.js


下一篇:wx小程序知识点(七)