February 10, 2006 at 7:06 am
I have a stored procedures which executes about 20 T-SQL Statements (Insert, Updates, Deletes and Selects). These Statements depend on each other. Is there any way to check the status of the previous T-SQL Statement? Is there anyway to create a log file within the Stored Procedure? For instance, a log file of the statements already executed and their executon status, whether they failed or succeeded. I know I could break this SP into sections and put in a DTS Package and use log files and/or emails based on failed or success status, but I wanted to keep the SP together and be able to track the status of the individual T-SQL Statements. We have SQL Server 2000 (SP3).
Thanks in advance for you help, Kevin
February 10, 2006 at 7:10 am
Perhaps examine @@ERROR after each SQL statement? Store the result in a table, then you will know which statement failed.
February 10, 2006 at 7:29 am
hi,
You have to use for each T - Sql satements
you should check,
on error goto err
if @@error<>0
go to err
err:
Rollback Transaction
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply