SQL 事务
2014-12-07 16:01
246 查看
/*========================事务==============================*/
begin tran--开始事务
--开始写流程语句
--语句写完之后
if @@ERROR>0
rollback tran --回滚事务
else
commit tran--提交事务
-------------练习
begin tran
delete from Score where Sno=109
delete from Student where Sno=105
if @@ERROR>0
begin
rollback tran
end
else
begin
commit tran
end
select *from Score where109
select *from Student
事务:保证数据的一致性
begin tran--开始事务
--开始写流程语句
--语句写完之后
if @@ERROR>0
rollback tran --回滚事务
else
commit tran--提交事务
-------------练习
begin tran
delete from Score where Sno=109
delete from Student where Sno=105
if @@ERROR>0
begin
rollback tran
end
else
begin
commit tran
end
select *from Score where109
select *from Student
事务:保证数据的一致性
相关文章推荐
- sql不常用函数总结以及事务,增加,删除触发器
- LINQ to SQL语句之开放式并发控制和事务
- Linq to Sql 学习系列之七 并发与事务
- SQL事务发布错误:当 IDENTITY_INSERT 设置为 ON 或某个复制用户向 NOT FOR...
- Web Service 使用分布式事务出错(OLE DB provider 'SQLOLEDB'无法启动分布式事务)
- SQL Server BI Step by Step SSIS 7 (End) --- 事务,错误输出,事件处理,日志记录
- sql 2008数据事务日志已满处理方法
- Delphi中数据集CacheUpdates属性与SQL事务联合应用代码示例
- T-SQL编程(事务)
- sql事务(Transaction)用法介绍及回滚实例
- python(11-4 数据库的事务 触发器 存储过程 慢查询及sql优化)
- Struts2+Ibatis+Spring.30(完整例子,含3.0事务配置,OSCache缓存配置,JreeChart配置,log4j日志输出Sql,对一个表实现完整的查询,批量删除,添加,更新)
- (引用).Net事务处理原则以及SQL和存储过程级别事务
- XenDesktop SQL Server Mirror事务日志维护
- DB2数据库的事务日志已满。. SQLCODE=-964, SQLSTATE=57011, DRIVER=3.63.108
- Oracle_PL/SQL的基本写法_BEGIN_END块结构及简单的事务实现
- 数据库误操作,如何恢复数据(SQL事务,或数据库还原)
- JAVA中处理事务的程序--多条更新SQL语句的执行(包括回滚)
- 20150106--SQL事务操作+触发器二
- SQL 2008 截断事务日志不能用了??