Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1272
  • Last Modified:

SQL Server Severity - Raiserror vs sp_addmessage

sp_addmessage allows one to optionally specify an error severity level, RAISERRROR requires it.  I don't
see what the point of assigning a severity level when using sp_addmessage, because I'm going to have
to specify it again when using RAISERROR as it is oblivious to the error numbers assocated severity
level.

The only way it makes sense to me is that before I use a custom error message that I query the sysmessages
table to see what severity level was used when the message was added, then use that severity level in
the RAISERROR call.  Am I missing something?  Do people actually use severity level this way?
0
dancebert
Asked:
dancebert
  • 2
1 Solution
 
vindevogelCommented:
Setting the Severity Level, either completely stops your SP without even considering the next line (which could have been a RETURN @)

Somebody even told me that if you set the severity high enough, it stops the sql server.

That's what I made of it
0
 
DanRollinsCommented:
Hi dancebert@pcsupport,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept vindevogel's comment(s) as an answer.

dancebert@pcsupport, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
==========
DanRollins -- EE database cleanup volunteer
0
 
vindevogelCommented:
DanRollings, thanks for interfering.

Dancebert:

First of all, you post a question hoping to get help fast.  I gave you a (possible) answer after an hour and a half.  I consider this pretty fast.

You abondon the question without further notice.

Some people, like I, are not here for earning money or so.  We like to help.  Therefore, we als like some appreciation.
You have graded me with the lowest grade possible.  This is to me a sign of disrespect.

DanRollings: could you please delete this question from me scoreboard.  This is a blame on the other 110 questions I solved on EE.

Thanks.
0
 
dancebertAuthor Commented:
vindevogel's comment, that setting severity level stops the SP, is true.  It also has very little to do with the question I asked.  The second line of my question was: "I don't see what the point of assigning a severity level when using sp_addmessage, because I'm going to have
to specify it again when using RAISERROR.."  

I wasn't asking what a severity level did, I was asking why would anyone use it as an optional parameter to sp_addMessage.  My guess is that vindevogel was unable to see the distinction because of his limited command of the english language.

The question wasn't answered.  I accepted his comment as a answer just to close the books on this.

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now