sql server - how to efficiently catch errors when working with T-SQL -


i'm looking way catch errors without using classic try catch because code doesn't work on sql version (2005)

begin try     select 1/0; end try begin catch     execute usp_geterrorinfo; end catch; 

error:

msg 170, level 15, state 1, line 1 line 1: incorrect syntax near 'try'. msg 156, level 15, state 1, line 6 incorrect syntax near keyword 'end'. 

any workaround? or doing wrong?

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 

is standard try..catch syntax. , supported in 2005 version. see here details.


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -