Tuesday, November 22, 2011

Error Handling in SP

BEGIN CATCH
   DECLARE @ErrorSeverity INT
   DECLARE @ErrorState INT
   SELECT
    @ErrorMessage = ERROR_MESSAGE(),
    @ErrorSeverity = ERROR_SEVERITY(),
    @ErrorState = ERROR_STATE(),
    @ErrorCode = ERROR_NUMBER()
 
   RAISERROR (@ErrorCode,@ErrorSeverity,@ErrorState,@ErrorMessage)--(50327,14,1)
   RETURN 1
END CATCH

No comments:

Post a Comment