I have over a million records in this newtable. new status need to be saved after every 1000 records.
Database is NAV 4SP3 with SQL 2005.
And here is the code from the codeunit we are running
NewTable.RESET;
NewTable.SETCURRENTKEY(status);
NewTable.SETRANGE(status,NewTable.status::inactive);
IF NewTable.FINDSET(TRUE,TRUE) THEN //Navision does a locktable here
repeat
newtablecopy := newtable;
//some calculations here
.....................................
....................................
//end of caluclations
newtablecopy.status := NewTablecopy.status::active;
newtablecopy.modify;
counter := counter + 1;
if counter = 1000 then begin
counter := 0;
commit;
// The question is
//how do I lock the table again and still be in the same loop
// Is newtable.locktable good enough?
end;
until newtable.next = 0;
The question is
how do I lock the table again after commit and still be in the same loop
Is newtable.locktable good enough?
Cheers,
Mike
0
Comments
so far, so good
And if you are reding more than 500 records, better is to use LOCKTABLE and FIND('-'), because FINDSET is optimal for sets smaller than 500 records (depends on the settings in dtabase properties).
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.