Solved

SQL Server Severity - Raiserror vs sp_addmessage

Posted on 2002-03-19
4
1,175 Views
Last Modified: 2008-01-09
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
Comment
Question by:dancebert
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
vindevogel earned 200 total points
ID: 6880548
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 7634168
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
 
LVL 4

Expert Comment

by:vindevogel
ID: 7648126
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
 
LVL 9

Author Comment

by:dancebert
ID: 7653723
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question