RAISERROR conversion from SQL Server 8 to 11 -


i have moved database form old legacy mssql server 2000 (sql server 8) sql server 11 , im receiving errors in several triggers.

they formed this.

raiserror 20001 @msg 

and

raiserror 44444 'field ''comp_v1'' cannot contain null value.' 

so after reading see known change, cant find known solutions.

at first thought replace them this

raiserror ('field ''comp_v1'' cannot contain null value.',16,-1) 

the issue here is, have no real idea on effect has, , if there straightforward conversion old line new line.

im assuming there reason codes 44444 , 20001 etc.

i advise use throw keyword throw error. can check reasons:

with throw benefit is: not mandatory pass parameter raise exception. using throw; statement error details , raise it

whereas raiserror

with raiserror developers had use different error_xxxx() system functions error details pass through raiserror() statement, like:

  • error_number()
  • error_message()
  • error_severity()
  • error_state()

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -