ALTER PROC usp_AccountTransaction  

    @AccountNum INT,  

    @Amount DECIMAL  

AS  

BEGIN  

    BEGIN TRY --Start the Try Block..  

        BEGIN TRANSACTION -- Start the transaction..  

            UPDATE MyChecking SET Amount = Amount - @Amount  

                WHERE AccountNum = @AccountNum  

            UPDATE MySavings SET Amount = Amount + @Amount  

                WHERE AccountNum = @AccountNum  

        COMMIT TRAN -- Transaction Success!  

    END TRY  

    BEGIN CATCH  

        IF @@TRANCOUNT > 0  

            ROLLBACK TRAN --RollBack in case of Error  

        -- you can Raise ERROR with RAISEERROR() Statement including the details of the exception  

        RAISERROR(ERROR_MESSAGE(), ERROR_SEVERITY(), 1)  

    END CATCH  

END  

GO

  

最新文章

  1. PHP之session与cookie
  2. ListView+CheckBox实现全选 单击效果
  3. mybatis入门基础(二)----原始dao的开发和mapper代理开发
  4. ComponentOne 2016 V3 发布
  5. Python QRCODE
  6. ZJOI2016 Round 1 之前
  7. linux学习笔记1
  8. 装过photoshop后出现configuration error
  9. Jquer学习
  10. web服务器压力测试工具
  11. 扩展欧几里得算法(extended Euclidean algorithm)的一个常犯错误
  12. CC++初学者编程教程(5) 安装codeblocks软件开发环境
  13. html 5 新增标签及简介
  14. angular 表单验证
  15. OOP编程七大原则
  16. c++ cin cin.getline() getline()用法
  17. 1095 Anigram单词
  18. Git 学习笔记--删除错误提交的commit
  19. 基于jQuery+CSS3实现人物跳动特效
  20. Extjs4.2 TreeView TreeStore 移除节点不触发delete(remove node don't trigger delete method)

热门文章

  1. Google的10大座右铭
  2. 微信iOS SDK文档总结
  3. 数学之路-python计算实战(6)-numpy-ndarray
  4. POJ --3045--Cow Acrobats(贪心模拟)
  5. Mysql优化ibdata1大小
  6. 升级JDK9后eclipse无法启动的解决方法
  7. Kinect 人机交互开发实践
  8. 开源映射平台Mapzen加入了Linux基金会的项目
  9. 紫书 习题 10-9 UVa 294(正约数个数)
  10. Java 异常的捕获与处理详解 (一)