Hi We are calling a stored proc spChild from the parent stored proc spParent. 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 ?
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... Bambola.
but the select om sysmessages would require dbo permission to be given to the user. Isn't there a sql function
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) Cheers Twan
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. Gaurav Moderator Man thrives, oddly enough, only in the presence of a challenging environment- L. Ron Hubbard