I am running SQL SERVER 2005 --- I want to run a try catch statement to do this
BEGIN TRY
--If this statement does not execute succesfully I want to go to the catch
SQL STATEMENT 1
END TRY
BEGIN CATCH
SQL STATEMENT 2
END CATCH
Either statement 1 or statement 2 will be valid, but when I try that code, it only evaluates my Statement1 and then throws the INVALID COLUMN NAME message as opposed to jumping to the CATCH statement. Can someone explain why?
BEGIN TRY
--If this statement does not execute succesfully I want to go to the catch
SQL STATEMENT 1
END TRY
BEGIN CATCH
SQL STATEMENT 2
END CATCH
Either statement 1 or statement 2 will be valid, but when I try that code, it only evaluates my Statement1 and then throws the INVALID COLUMN NAME message as opposed to jumping to the CATCH statement. Can someone explain why?