Convert Raiserror to resultset

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.
Who is Participating?
ajith_29Connect With a Mentor Commented:
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
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.
MichaelJCAuthor Commented:
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>

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.