Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Convert Raiserror to resultset

Posted on 1999-06-28
3
Medium Priority
?
1,116 Views
Last Modified: 2012-05-04
I have sps created by a third party. They return business rules by using raiserror, giving me back a number and description for each error. I can read these in VB fine. How can I capture these in a sp that calls the third party sp and returns the business rules as a resultset?  Basically, I need to know how to cycle through the errors generated by the raiserror statement in Sybase and put them into a temp table.
0
Comment
Question by:MichaelJC
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:ajith_29
ID: 1098906
Hi Micheal,
Raiserror errors are generated using sysmessages table where there is column for error,description etc.,Syase system errors are stored to a range and the remaining range you can use for custom built raiserror.So put the sysmessages table to the temp table after the sybase's rang you will get the raiserrors for you.
Bye
0
 

Author Comment

by:MichaelJC
ID: 1098907
The sysmessages table returns EVERY error put in there, not just the ones that have been raised. Also, the errors that are being raised are not necessarily in the sysmessages table.  Here is an example of what I want to do:

raiserror 60000 'First error'
...
raiserror 70000 'Second error'
...
<select all raised errors>




0
 
LVL 2

Accepted Solution

by:
ajith_29 earned 100 total points
ID: 1098908
Hi Micheal,
You want to have everything readymade so take the answere.

The explanation
raiserror error_number


error_number - is an integer with a value greater than 17,000. If the  error_number is between 17,000 and 19,999, and format_string is missing or empty (""), SQL Server retrieves error message text from the  sysmessages table in the master database. These error messages are used chiefly by system procedures.

If error_number is 20,000 or greater and format_string is missing or empty,  raiserror retrieves the message text from the sysusermessages table in the database from which the query or stored procedure originates. SQL Server attempts to retrieve messages from either sysmessages or  sysusermessages in the language defined by the current setting of  @@langid.

This will solve your problem
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

In this article, I’ll show how research, determination, and use of modern technology helped me solve a DNA mystery.
The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

671 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