>>I was more interested in how your newid() coped with the "holes" between system-generated IDs and those higher up, imported, like mine. No doubt I'll figure it out but ... reinventing the wheel and all that! Guess the least injurious would be to go to Integer - come to think of it, hardly a problem at all ('cept where I'd have to validate 4 num on input as int. would take anything)
>
>The newest ID goes to the highest bidder. That's why I mentioned calculating the max() once upon a session (vfp session or datasession). So if there are some data down there which landed into the table without newid()'s knowing, it will take the highest one in use, and then compare that with its id.lastid and take the max of that as the last used id. Since my keys are either integer or at least five-digit left-zero-padded strings containing digits, I never had a problem with going through the roof.
>
>Um... there was one thing but that was just a little marketing thing: the customer code was four digit. And I'd warn the users about that, and would usually say "once you get to have more than 9999 customers, I'll just jump in and widen the field for free". Since most of my customers were small businesses, very few among them had more than 200 customers total, so the talk of 9999 customers sounded like a dream to them :).
Thanks Dragan. That last idea ... seems that there was a lot of that pre year 2000 with date fields if my memory serves me... <bg> not done for free though.
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.