DBAtlas · Database operations atlas

50000: Custom error raised with RAISERROR

SQL Server

What does it mean?

This is the default number (50000) for custom (user-defined) errors raised with RAISERROR without specifying a message ID. Application/procedure logic deliberately raised an error.

Why does it happen?

A custom error raised with RAISERROR or THROW in a stored procedure or script on a business rule violation, a validation failure, deliberate flow control, or custom exception messages.

How to fix it

Read the RAISERROR/THROW message text to understand the actual business rule violation. Catch this error on the application side with TRY...CATCH and get details with ERROR_MESSAGE()/ERROR_NUMBER(). Define messages with sp_addmessage to give your custom errors meaningful numbers. Fix the triggering condition in the business logic.

Open in DBAtlas →

More from this engine