if OBJECT_ID('testtb') is not null
drop table testtb
go
create table testtb
(id int identity(1,1) not null,
iQty dec(18,2),
Version timestamp
)
insert into testtb (iQty)
select 12
begin tran
select CAST(Version as bigint) from testtb
where id=1
update testtb set iQty=12 where id=1
select CAST(Version as bigint) from testtb
where id=1
commit tran
我想在第二次查询到的版本号 与第一次查询到版本号一样,请问怎么设置查询呢?
------解决方案--------------------
这个不行,只要改变过就会递增版本,事务无效
可以自定义版本,如用触发器等