Solved

SQL Server Severity - Raiserror vs sp_addmessage

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

778 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