/*****隱式事務*****/
来源:互联网 发布:知乎怎么看答谢 编辑:程序博客网 时间:2024/06/07 23:12
/**//*****隱式事務*****/
/**//*****sql 的行為就類似一個快餐店,當你需要時,必須付款,
如果返回又想要一些額外的食物,你必須再付款。
ANSI行為就像去了飯店。你訂湯,服務員為你記賬,當你訂更多的東西時,他們負責添加到賬上
,最后你付款。
*****/
/**//*****#1*****/
set implicit_transactions off
go
if exists( select * from dbo.sysobjects where id=object_id('nesttran'))
drop table nesttran
go
create table nesttran(id int identity(1,1) not null,transcount int)
go
insert nesttran
values(@@trancount)
go
select * from nesttran where id=1
select @@trancount as transcount
/**//*****#2*****/
begin tran
insert nesttran
values(@@trancount)
commit
go
select * from nesttran where id=2
select @@trancount as transcount
/**//*****#3*****/
begin tran
begin tran
insert nesttran
values(@@trancount)
select @@trancount as transcount
commit
select @@trancount as transcount
commit
go
select * from nesttran where id=3
select @@trancount as transcount
/**//*****#4*****/
set implicit_transactions on
go
insert nesttran
values(@@trancount)
commit
go
select @@trancount as transcount
select * from nesttran
where id=4
select @@trancount as transcount
commit
select @@trancount as transcount
go
/**//*****#5*****/
insert nesttran
values(@@trancount)
begin tran
insert nesttran
values(@@trancount)
commit
commit
go
select @@trancount as transcount
select * from nesttran
where id=5 or id= 6
select @@trancount as transcount
commit
select @@trancount as transcount
/**//*****#7*****/
set implicit_transactions off
drop table nesttran
go
/**//*****sql 的行為就類似一個快餐店,當你需要時,必須付款,
如果返回又想要一些額外的食物,你必須再付款。
ANSI行為就像去了飯店。你訂湯,服務員為你記賬,當你訂更多的東西時,他們負責添加到賬上
,最后你付款。
*****/
/**//*****#1*****/
set implicit_transactions off
go
if exists( select * from dbo.sysobjects where id=object_id('nesttran'))
drop table nesttran
go
create table nesttran(id int identity(1,1) not null,transcount int)
go
insert nesttran
values(@@trancount)
go
select * from nesttran where id=1
select @@trancount as transcount
/**//*****#2*****/
begin tran
insert nesttran
values(@@trancount)
commit
go
select * from nesttran where id=2
select @@trancount as transcount
/**//*****#3*****/
begin tran
begin tran
insert nesttran
values(@@trancount)
select @@trancount as transcount
commit
select @@trancount as transcount
commit
go
select * from nesttran where id=3
select @@trancount as transcount
/**//*****#4*****/
set implicit_transactions on
go
insert nesttran
values(@@trancount)
commit
go
select @@trancount as transcount
select * from nesttran
where id=4
select @@trancount as transcount
commit
select @@trancount as transcount
go
/**//*****#5*****/
insert nesttran
values(@@trancount)
begin tran
insert nesttran
values(@@trancount)
commit
commit
go
select @@trancount as transcount
select * from nesttran
where id=5 or id= 6
select @@trancount as transcount
commit
select @@trancount as transcount
/**//*****#7*****/
set implicit_transactions off
drop table nesttran
go
- /*****隱式事務*****/
- 弹出窗口代码大全
- Lazarus实践 --- 访问SQL Server
- 剖析Linux病毒原型的工作过程和关键环节
- C# base
- IIS、ASP.NET和SQLServer的安全性问题
- /*****隱式事務*****/
- UNIX 的二十年发展史
- Java2游戏编程读书笔记(13-2)
- Excel Upload...
- How to become a programmer
- 克隆Shark,做一个适合CS系统的工作流产品
- 垂直搜索前途与命运的问题--复:爱游泳的鱼[原创]
- [H/W] EFI Boot Option Menu信息的备份方法
- javascript下的数组及其操作