| Author: Animesh Paul 11 May 2007 | Member Level: Bronze | Rating:  Points: 2 |
suppose we have a statement "select * from Table1" now if error occurs while fetching data from Table1, then we can catch the error the following way:
select * from Table1 if @@ERROR <> 0 then goto ERR
ERR: BEGIN RAISERROR('Fetching Test Case Objects Failed.', 15, 2) RETURN END
|
| Author: Pankaj Mishra 11 May 2007 | Member Level: Diamond | Rating:  Points: 2 |
Hi, you can use Try/catch block if you are using sqlserver2005 eg
BEGIN TRY --your sql statements END TRY BEGIN CATCH --your sql statements END CATCH
Regards Pankaj
|