Jason Clark
Jason Clark

Reputation: 1425

How to print Error Message in stored procedure in SQL Server 2014?

I am using SQL Server 2014. Can any one tell me that how can i print a specific Error Message in my stored procedure?

Upvotes: 0

Views: 1192

Answers (1)

Adnan Nazir
Adnan Nazir

Reputation: 86

Have you tried using Throw? SQL 2014 doesn't support RAISERROR() for native SPs. While Throw is supported.

  THROW [ { error_number | @local_variable },
    { message | @local_variable },
    { state | @local_variable } ] [ ; ]

For Example:

   THROW 5000, 'THROW TEST', 1

https://msdn.microsoft.com/en-us/library/ee677615.aspx

http://sqlhints.com/2013/06/30/differences-between-raiserror-and-throw-in-sql-server/

Upvotes: 1

Related Questions