Solved

SQL Server Severity - Raiserror vs sp_addmessage

Posted on 2002-03-19
4
1,110 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now