SQL Server Performance

Get Error Message

Discussion in 'General Developer Questions' started by kate_for_u, Sep 9, 2003.

  1. kate_for_u New Member


    We are calling a stored proc spChild from the parent stored proc
    The spChild will raise an error which we will catch inside spParent.
    Now the problem is while we are able to get the error number by
    using @@Error , We are not getting the 'Error Message'.

    Is there some @@Error message type to get error message in sql server,
    similar to @@error ?

  2. bambola New Member

    You can find the error messages in sysmessages system table.
    select description from sysmessages where error = 107
    But I don't really know if there is a way to get the formatted message...

  3. kate_for_u New Member

    but the select om sysmessages would require dbo permission
    to be given to the user.
    Isn't there a sql function
  4. Twan New Member

    I don't think that there is any way to get the same description (i.e. with any placeholders replaced) other than client-side such as ADO, etc.

    You would need to use output parameters on the child procedure to get the error message and number without raising an error (which will go back to the client)

  5. gaurav_bindlish New Member

    You can create a stored procedure which will take the error number and return the error message to the client. Create this login using dbo login and grant permissions to all users.

    Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard

Share This Page