SyntaxFix
Write A Post
Hire A Developer
Questions
You could use THROW (available in SQL Server 2012+):
THROW
THROW 50000, 'Your custom error message', 1 THROW <error_number>, <message>, <state>
MSDN THROW (Transact-SQL)
Differences Between RAISERROR and THROW in Sql Server