September 20, 2004 at 5:11 am
We need to retrieve the Constraint Name and Table name from the System error messages through from a procedure.
For e.g If the insert fails due to Unique constraint error, SQL Server throws system error along with the unique constraint name and table name.
Please suggest a way by which we can get the constraint name and table name from the error message?
Thanks in advance.
September 20, 2004 at 8:11 am
The resolved errormessage must be trapped at the calling side (eg client). Some errors are not possible to trap within a stored procedure.
All errors are sent to the caller, though, which is where you should trap and handle it.. (calling side may be client app, batch *.cmd file or the like)
/Kenneth
September 21, 2004 at 1:10 am
Thanks Kenneth
But the problem here is we need to catch the error message (tablename and column name) in a calling procedure.
Any suggestions for that.
September 21, 2004 at 1:46 am
u mean , u want some method by which u can get the table name and stored procedure name , in which the err occured.
or u just want to debug a specific error message
<a href="http://www.websolsoftware.com"> For IT jobs click here</a>
*Sukhoi*[font="Arial Narrow"][/font]
September 21, 2004 at 7:16 am
Unfortunately, the resolved errormessage isn't trappable from within Transact SQL.
A method to avoid this problem could perhaps be to avoid inserting duplicates into a unique constraint? It's not that hard to do, and there are several ways to ensure that an insert does not attempt to insert if a value already exists.
/Kenneth
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply