>These are the same in function, Rich, but not implementation. Using a FOR clause is fine if you are confident that no other users will be adding records to the table duringthe execution of your command. But since REPLACE and DELETE, when used with the FOR clause lock the table header, other users will be prevented from adding records to the table during the execution of the command. So, sometimes, even though it mightn't be as fast, a SCAN loop is desirable.
You're absolutely correct, and I knew it, but forgot. In fact, I remember a specific case where I used a SCAN ... DELETE ... ENDSCAN loop (in an archive old records routine) for just this reason. I took care to document why I did it in the code, so some other idiot wouldn't come along and do what I just said to do earlier in the thread, replace the loop with a DELETE FOR command. This way the archiving routine no longer had to be done as a night-time maintenance type function.
Thanks for reminding me!
Cheers,
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing