SQL事务


declare @funid int ;
SET XACT_ABORT ON ----语句产生运行时错误,则整个事务将终止并回滚。
Begin Tran

insert into [dbo].[test]([ids]) values('1222');set @funid = (select @@identity)

 

insert into [dbo].[test2]([testid]) values(@funid);
Commit Tran

 

posted @ 2017-10-18 14:29  914556495  阅读(105)  评论(0编辑  收藏  举报