sybase分批提交
对于sybase更新操作,如何来做到分批操作,比如一次提交2万行,各位大侠如何操作也?谢,没得分数了,确实不好意思...
对于sybase更新操作,如何来做到分批操作,比如一次提交2万行,各位大侠如何操作也?谢,没得分数了,确实不好意思
展开
1个回答
展开全部
试试如下方法,
declare @errorStatus int, @rowsProcessed int
set rowcount 20000
select @rowsProcessed = 1
while (@rowsProcessed != 0)
begin
begin tran
update ...
from ...
where ...
select @rowsProcessed = @@rowcount, @errorStatus = @@error
if (@errorStatus != 0)
begin
raiserror ....
rollback tran
return -1
end
commit tran
end
set rowcount 0
declare @errorStatus int, @rowsProcessed int
set rowcount 20000
select @rowsProcessed = 1
while (@rowsProcessed != 0)
begin
begin tran
update ...
from ...
where ...
select @rowsProcessed = @@rowcount, @errorStatus = @@error
if (@errorStatus != 0)
begin
raiserror ....
rollback tran
return -1
end
commit tran
end
set rowcount 0
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询