check this out
http://msdn.microsoft.com/en-us/library/ms175976(v=SQL.90).aspx[
^]
BEGIN TRY
Try Statement 1
Try Statement 2
...
Try Statement M
END TRY
BEGIN CATCH
Catch Statement 1
Catch Statement 2
...
Catch Statement N
END CATCH
if one of the statements causes an error in Try Block, control branches immediately to the start of the CATCH block
The following system functions are available in the CATCH block and can be used to determine additional error information
Function Description
___________________________________________________________________________________
ERROR_NUMBER() Returns the number of the error
ERROR_SEVERITY() Returns the severity
ERROR_STATE() Returns the error state number
ERROR_PROCEDURE() Returns the name of the stored procedure or trigger where
the error occurred
ERROR_LINE() Returns the line number inside the routine that caused error
ERROR_MESSAGE() Returns the complete text of the error message.
The text includes the values supplied for any substitutable
parameters, such as lengths, object names, or times