Is it possible to suppress the default error message when using `RAISERROR`?

Question

Grade: Education Subject: Help
Is it possible to suppress the default error message when using `RAISERROR`?
Asked by:
76 Viewed 76 Answers

Answer (76)

Best Answer
(271)
Yes, setting the `ERRORSEVERITY` and `LASTSEVERITY` session variables can suppress the default error message. Before calling `RAISERROR`, set `SET ERRORSEVERITY TO 0;` and `SET LASTSEVERITY TO 0;`. This ensures that only the custom message from `RAISERROR` is displayed.