December 28, 2007 at 3:07 am
Hi,
I've executed the sp and it contains more number of internal sp's. If any sp's execution failure due to some reasons, i want to store the error description into some table. Can you please help me to store the error description in some table.
January 6, 2008 at 6:21 pm
What kind of error do you want to store? System error, procedure error or data error?
January 6, 2008 at 11:11 pm
Thanks for replying.A kind of data error, I want to store it in Table. For example, if it throws some mismatch sql statements, or syntax error, it will be stored in the table
January 7, 2008 at 1:11 pm
I am still not very sure what you want to store because you said something about syntax error.
I had created a error table before to store the errors of some of my procedures.
CREATE TABLE Err_Table (ErrID INT IDENTITY(1,1) NOT NULL,
ProcedureName VARCHAR(250) NOT NULL,
ErrorDesc VARCHAR(250) NOT NULL,
ErrorLogTime DATETIME NOT NULL)
In the procedure that you want to capture the error, you just need to insert data into the table.
For example if the select statement has an error or it returns 0 record when you expect it should return data.
DECLARE @Error INT, @Rowcount INT
SELECT .... FROM ....
SELECT @Error = @@ERROR, @Rowcount = @@ROWCOUNT
IF @Error <> 0
INSERT INTO Err_table (ProcedureName, ErrorDesc, ErrorLogTIme) SELECT 'procedure', 'SELECT ...Statement returned error', GETDATE()
IF @Rowcount = 0
January 7, 2008 at 11:43 pm
Thanks for your reply
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply