using try catch finally in SQL
2010-10-20 15:25
561 查看
-- sorry, it looks so like the assemble language struct
-- when power not enough, or memory capacity not enough, or other reasons
delete from table1 where id='123456789'
-- @@ERROR is a global error variable, it will err when its variable is not 0
if @@ERROR!=0 goto catch
-- do something, when all are right.
-- after do something, you should go to do final thing
goto finally
catch:
print 'an exception has occured!'
finally:
print 'do something finally'
-- when power not enough, or memory capacity not enough, or other reasons
delete from table1 where id='123456789'
-- @@ERROR is a global error variable, it will err when its variable is not 0
if @@ERROR!=0 goto catch
-- do something, when all are right.
-- after do something, you should go to do final thing
goto finally
catch:
print 'an exception has occured!'
finally:
print 'do something finally'
相关文章推荐
- Using TRY/CATCH to Resolve a Deadlock in SQL Server 2005
- 浅谈Try catch finally 与using
- using 和 try catch finally 的用法
- [FW]: Using the Try Catch Blocks in Transactions
- 可以使用 using 或者 try-catch-finally 调用 Dispose() 来释放非托管资源
- Try-Catch-Finally in PHP
- C# using 与Try-catch-finally的区别和用法
- C# using 与Try-catch-finally的区别和用法
- try catch finally执行顺序
- Tracing SQL Queries in Real Time for MySQL Databases using WinDbg and Basic Assembler Knowledge
- try_catch_finally的注意事项
- try catch finally的用法
- java-try...catch...finally
- (转)java 中的try catch finally 语句中含有return语句的执行情况(总结版)
- Try…catch…finally
- try catch finally 与return的执行顺序
- [Ramda] Handle Errors in Ramda Pipelines with tryCatch
- try catch finally的执行顺序即结果
- Java异常捕获之try...catch...finally语句
- JAVA异常处理方式 try-catch-finally