I am using SQL Server 2005 and am trying to execute the following statements:
BEGIN TRY SELECT 1/0 END TRY BEGIN CATCH SELECT 'Error Caught' END CATCH I am getting the following errors:Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'TRY'.
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'END'.
This code should work, can anyone tell me why it it not working?
Thanks in advace.
Hmmm, works fine here.
Is there something else you have coded in the same script?
Are you using SSMS?
|||Sorry, my mistake. I was using our SQL Server 2005 Management Studio, but had accidentally connected to the SQL Server 2000 box to test with. Thanks.|||Been there, done that
No comments:
Post a Comment