Situation:
We have taken over a customer of another Solution Center.
A codeunit was written to run some jobs from the job scheduler executed by a NAS.
This codeunit contains a loop where fields are updated which are in the current key (The famous Next from Hell). As the example below:
recCust.SETRANGE("Country/Region Code", 'BE');
IF recCust.FINDSET(TRUE) THEN
REPEAT
recCust.VALIDATE("Country/Region Code", 'US');
recCust.MODIFY;
UNTIL recCust.NEXT = 0;
I'm convinced that this code causes problems to execute all the jobs of the job scheduler.
This code is already a few years old. In the past they didn't have that much problems with this piece of code.
Since they have upgraded the SQL server from 2005 to 2008 the problems became more frequent.
My question is if this SQL server 2008 reacts different to this "Next from Hell" than SQL server 2005?
The customer is using a 3.70 database with a 5.0 SP1 client.
0
Comments
or replace it with a modifyall in this case
as far as i can tell from experience i havent seen much of a difference in behaviour between the 2 sql versions when working with a database for this kind of loops.
What matters is how NAV queries the data, and this is a matter of the NAV Client Version - did you accomplish a "Technical Upgrade" with NAV while upgrading the SQL Server?
But as you said, tgis code sucks; better do the changes on a separate variable:
NAV/SQL Performance Optimization & Troubleshooting
STRYK System Improvement
The Blog - The Book - The Tool
And maybe add a SETCURRENTKEY with "Country/Region Code" in it?
RIS Plus, LLC
It is actually about the standard NAV 3.70 code to start the job scheduler.
If there was an error in the proces the Runstatus is changed in codeunit RunObjectFromJobSched
Then Navision losses his pointer and the Job Scheduler can skip some jobs.
Microsoft already changed the code in NAV 4.0 by using 2 variables. JobSchedSetup & JobSchedSetup2
I assume that this is to prevent the lost of the pointer.
As said earlier our customer runs on a 5.0 SP1 client (not since the migration).
Is it better to use 2 variables or to use FINDSET(TRUE,TRUE)