Try Catch is not working

Last Post 26 Apr 2006 12:31 PM by bugmenot3. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
Shafiq
New Member
New Member

--
28 Mar 2006 05:13 AM
Hi,

I am just checking the following code but try/catch is not working

USE AdventureWorks;
GO

BEGIN TRY
PRINT N'Starting execution';

SELECT * FROM HumanResources.EmployeeNoTable;
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_MESSAGE() AS ErrorMessage;
END CATCH;
GO

I am getting following error on execution
Starting execution
Msg 208, Level 16, State 1, Line 9
Invalid object name 'HumanResources.EmployeeNoTable'. I think I should just get the ErrorNumber & ErrorMessage in select statement. Is there any configuration which has to be done before testing Try/Catch

Thanks
bugmenot3
New Member
New Member

--
26 Apr 2006 12:31 PM
Compile Errors are not caught. Please look at the blog http://blogs.msdn.com/sqlprogrammab...71048.aspx for more details.

thanks
You are not authorized to post a reply.

Acceptable Use Policy