SqlServer查询中使用事务

    --获取一个新的ID
declare @newId bigint
select @newId=MAX(ID) from BdRdRecord01 begin tran
if @newId< or @newId is null
begin
set @newId=
insert into BdRdRecord01(ID,bRdFlag) values (@newId,)
end
else
begin
set @newId=@newId+
insert into BdRdRecord01(ID,bRdFlag) values (@newId,)
end if @newId< or @newId is null
begin
rollback tran ---回滚事务
set @newId=-
end
else
begin
commit tran --执行事务
end select @newId
上一篇:[LeetCode&Python] Problem 485. Max Consecutive Ones


下一篇:Web性能优化之图片延迟加载