课外天地 李树青学习天地数据库系统原理课件 → 关于SQL Server数据库系统中事务处理编程的学习资料


  共有20315人关注过本帖树形打印复制链接

主题:关于SQL Server数据库系统中事务处理编程的学习资料

帅哥哟,离线,有人找我吗?
admin
  1楼 博客 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信 管理员
等级:管理员 帖子:1939 积分:26594 威望:0 精华:34 注册:2003/12/30 16:34:32
关于SQL Server数据库系统中事务处理编程的学习资料  发帖心情 Post By:2006/5/22 21:00:47 [只看该作者]

1、事务提交编程: begin tran newtran use students update stu1 set birthday=birthday-365 update stu2 set age=age+1 commit

2、事务回滚编程: begin tran newtran use students update stu set birthday=birthday-365 update stu set age=age+1 select * from stu rollback select * from stu1 select * from stu2

或者: begin tran newtran use students select * from stu update stu set birthday=birthday-365 select * from stu rollback select * from stu

事务的保存点 begin tran newtran use students go select * from stu delete from stu where number='000001' select * from stu

save transaction after_delete select * from grade update grade set number='000007' where number='000001' select * from grade

if @@error!=0 or @@rowcount=0 begin rollback tran after_delete commit tran return end

commit transaction newtran go

[此贴子已经被作者于2006-12-14 16:49:12编辑过]

 回到顶部