Looking for good sample of TSQL error-handling

Please point me to a page or provide me with a nice sample of error-handling with TSQL.
jdanaAsked:
Who is Participating?
 
momi_sabagCommented:
for v2005 and v2008 it's quite simple:

begin try
 do your code here...
end try
begin catch
 do your code here
end catch

inside the catch you can use error_number() and error_message() in order to understand which error happended

in sql 2000 you will have to use the @@error variable
0
 
momi_sabagCommented:
which sql server version?
0
 
jdanaAuthor Commented:
Version 2005
0
 
jdanaAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.