I need to do large update in sybase.
Table1 has column a, b, c, e, f, around 9 million records. Table2 has column a, e, f, around 500000 records.
The bellow update sql failed due to syslog full
update table1
set e = table2.e, f = table2.f
from table1, table2
where table1.a = table2.a
After doing research in the internet, the bellow two procedures still failed due to the same error however they did update 5000 records successfully.
Any ideas. Thank you!
SET ROWCOUNT 5000
WHILE (1=1)
BEGIN
update table1
set e = table2.e, f = table2.f
from table1, table2
where table1.a = table2.a
IF @@ROWCOUNT != 5000
BREAK
END
SET ROWCOUNT 0
declare @errorStatus int, @rowsProcessed int
set rowcount 5000
select @rowsProcessed = 1
while (@rowsProcessed != 0)
begin
begin tran
update table1
set e = table2.e, f = table2.f
from table1, table2
where table1.a = table2.a
select @rowsProcessed = @@rowcount, @errorStatus = @@error
if (@errorStatus != 0)
begin
--raiserror ....
rollback tran
--return -1
end
commit tran
end
set rowcount 0