SQL异常处理语句

BEGIN TRY
END TRY
BEGIN CATCH
SET @InfoBar=ERROR_MESSAGE()
SET @Severity=16
EXEC dbo.RaiseErrorSp @Infobar = @InfoBar,
@Severity = @Severity, -- int
@State = 0 -- int    
RETURN @Severity
END CATCH

原文地址:https://www.cnblogs.com/slmdr9/p/8024651.html