存储过程中使用事务Transaction实例
2014-08-25 12:43
363 查看
实例一
实例二
参考资料: 存储过程中使用事务Transaction http://www.studyofnet.com/news/551.html
Create PROCEDURE [dbo].[tt2] As Begin Begin Transaction Update dbo.storeA Set Aid = 7 Where Aname ='N73' Update dbo.storeA Set Aid = 9 Where Aname ='N97' Insert Into dbo.storeA(Aid) Values('sdfs') --此语句将出错,LockTypeID为Int类型 Update dbo.storeA Set Aid = 8 Where Aname ='N95' Commit Transaction If(@@ERROR <> 0) Rollback Transaction End
实例二
Declare @id int BEGIN TRANSACTION Insert into xxxxxTable(f1,f2)values(@a,@b) Select @id=@@identity Insert into abcTable(ff1,ff2,ff3)values(@c,@id,@dd) IF @@error <> 0 --发生错误 BEGIN ROLLBACK TRANSACTION RETURN 0 END ELSE BEGIN COMMIT TRANSACTION RETURN 1 --执行成功 END
参考资料: 存储过程中使用事务Transaction http://www.studyofnet.com/news/551.html
相关文章推荐
- 在Mysql存储过程中使用事务实例
- 存储过程和.Net中使用事务的实例
- 在Mysql存储过程中使用事务实例
- Transaction And Lock--存储过程中使用事务的模板
- 在Mysql存储过程中使用事务实例
- 存储过程和.Net中使用事务的实例
- 存储过程和.Net中使用事务的实例
- 在mysql中的存储过程中使用事务transaction【以下内容仅供参考】
- 存储过程和.Net中使用事务的实例
- 存储过程使用实例
- asp.net(c#) 下SQL存储过程使用详细实例
- 存储过程中使用事务
- SQL SERVER2005 存储过程事务,游标实例
- 个人学习代码保存:例9.在存储过程中使用cast 类型转换的实例
- 存储过程中使用事务
- 存储过程事务的使用
- 存储过程中事务的使用方法
- sql2005 存储过程使用 事务 和 游标 例子
- 在SQL Server存储过程中使用事务及返回值
- sql T_sql 在存储过程中使用事务Trans 例子