title: Raise custom error message with RAISERROR in SQL Server
body: <p>In previous versions we raised errors in t-sql like:</p>
  
  <pre><code>RAISERROR 50000 'My Error Message'
  </code></pre>
  
  <p>In the latest SQL Server this syntax has been discontinued and replace with the RaiseError () syntax.</p>
  
  <p>I would like to have a generic method of raising errors, and the best I could come up so far is:</p>
  
  <pre><code>sp_addmessage @msgnum = 50001,
                @severity = 10,
                @msgtext = N'My Error Message', @replace = 'REPLACE';
  RAISERROR (50001, 10, 1, 'This error message is not displayed')
  </code></pre>
  
  <p>But I can't go and create a error message with sp_addmessage for every message, because there are 1000's.</p>
  
  <p>What is the better way to raise messages with a custom message?</p>