What is “Begin Trans”, “Commit Tran”, “Rollback Tran” and "save tran"
2014-09-23 20:28
375 查看
Begin Tran: - It’s a point which says that from this point onwards we are starting the transaction.
Commit Tran: - This is a point where we say we have completed the transaction. From
this point the data is completely saved in to database.
Rollback Tran: - This point is from where we go back to the start point that i.e. “Begin
Tran” stage.
Save Tran: - It’s like a bookmark for rollback to come to some specified state. When we
say “rollback Tran” we go back directly to “Begin Tran”, but what if we want to go back
to some specific point after “Begin Tran”. So “Save Tran” is like book marks which can
be used to come back to that state rather than going directly to the start point.
For Example:
Commit Tran: - This is a point where we say we have completed the transaction. From
this point the data is completely saved in to database.
Rollback Tran: - This point is from where we go back to the start point that i.e. “Begin
Tran” stage.
Save Tran: - It’s like a bookmark for rollback to come to some specified state. When we
say “rollback Tran” we go back directly to “Begin Tran”, but what if we want to go back
to some specific point after “Begin Tran”. So “Save Tran” is like book marks which can
be used to come back to that state rather than going directly to the start point.
For Example:
begin tran save tran a insert into Dept values('03','xx部门','03', null) save tran b insert into Dept values('02','xx',null,null) if @@error != 0 begin rollback tran b -- or a end save tran c insert into Dept values('04','xx医院','','') --this is a wrong code statement if @@error != 0 begin rollback tran c --or a,b end commit tran
相关文章推荐
- zz"Who do you think is the best coder, and why?"zz
- "Balancing Agility and Discipline" 中文版——《平衡敏捷与规范》终于要出版了
- 啃"创建线程"一章的疑难解析: 通读Concurrent Programming in Java: Design Principles and Patterns (2)
- "The C Programming Language", 2nd edition, Kernighan and Ritchie
- Grounding Data Converters and Solving the Mystery of "AGND" and "DGND"
- 處理 "df" and "du" 不一致的結果
- JVM - Concept and Lifetime (From book "Inside the Java Virtual Machine")
- "Balancing Agility and Discipline" 中文版——《平衡敏捷与规范》终于要出版了
- Debug error:"One or more breakpoints cannot be set and have been disabled.Execution will stop at the beginning of the program."
- Preventing "Return" and "Esc" From Closing Dialog
- Eclipse GEF 开发之:当图形editor被更改时Enable "Save" action
- WHAT IS “SINO"
- 解决Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/Savepoint
- Can I get rid of the "This page contains both secure and nonsecure items" warning?
- Introduction to " Divide and Conquer"
- "Programming Microsoft DirectShow for Digital Video and Television"中简介的翻译
- When and Why do we use "#if 0"
- WebDAV:"Web-based Distributed Authoring and Versioning"
- Example of "Negative lookahead and lookbehind"
- "Balancing Agility and Discipline" 中文版——《平衡敏捷与规范》终于要出版了