OPPOSITION

I am trying to execute the following code:

THROW 51051, 'I come from the THROW construct :)', 1 ; 

The error I am getting is:

 Could not find stored procedure 'THROW'. 

Is the THROW procedure a sytem procedure? Why can't he find him?

Moreover, what is the difference between canceling THROW and ErrorState? Is a person older / higher / better than another? And what does ErrorSeverity and ErrorState mean from ErrorState? Can I define them as I will or are they predetermined?

+6
source share
2 answers

Yes, it is, but only since 2012 . If you are using 2008R2, then it was not there.

Status and severity definitions are clearly documented in the raiserror documentation .

+5
source

Read the following: Differences between RAISERROR and THROW on Sql Server


Both RAISERROR and THROW are used to raise the error in Sql Server . The RAISERROR journey began with Sql Server 7.0 , where when the THROW journey just started with Sql Server 2012 . obviously, Microsoft is suggesting that we start using the THROW statement instead of RAISERROR. THROW seems simple and easy to use than RAISERROR .

+5
source

Source: https://habr.com/ru/post/970626/


All Articles