Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Boudewijn Lutgerink
  Where is Boudewijn Lutgerink?
 Hoonaardstraat, Driel
 Netherlands
 Boudewijn Lutgerink
 To: Lenchz Negans
  Where is Lenchz Negans?
 Makati
 Philippines
 Lenchz Negans
 Tags
Subject: RE: Best Strategy for Creating Unique ID
Thread ID: 159903 Message ID: 159994 # Views: 60 # Ratings: 1
Version: Visual FoxPro 9 Category: Databases, Tables and SQL Server
Date: Monday, February 11, 2008 4:44:52 PM         
   


>
> Thanks Ken,
>
> Incrementing Integers as an ID may resolve my problem. Since development will be used not only by a single user, There will be possibility that during record creation, 2 users may get the same IDs. What do you think? And another thing is, Is there any solution not to skip available IDs in case of deleted records?
>
> What I'm trying to do here is to optimize the Use of IDs.
>
> 00000001 - taken
> 00000002 - taken
> 00000003 - taken
> 00000004 - deleted record(this ID should be available for use again)
> 00000005 - taken
> ...
>
> I welcome other alternative solution for this.
>
> Thank u,

Lenchz

Here is an alternative... way of thinking.

I would not worry a bit about a skipped identifier.
Let's do a bit of math here.
As Ken already said you can store values from -2147483647 to 2147483647 in an integer field.
This means that you can store (with the zero also being an identifier) 4294967295 unique records.
Now I assume you will store a record EVERY second, 24/7 no downtime and the system will run without glitch till the maximum is reached.
One unique record every second means that you will use a bit longer than 136 years to fill the system.

4294967295 unique identifiers
3600 seconds in an hour
24 hours a day
365.25 days (avg) per year.

makes 136,09930080234238345121302000152 years.
I do not know about YOUR plans, but my take is not to live that long.
If I would do that then I could just as well wait till the year 9999 to live, and solve the new millenium problem...

Even if you only take the positive numers you would have more than 60 years before you run out of identifiers.
Do you really care?

In Dutch there is a translation for "doing it the easy way". This is "Wy do it difficult if you can have it the easy way."
To me it seems that you turn things around, as in, "Why do it the easy way if you can do it difficult."

Then there is another problem, VFP cannot handle that many records in one table. So, once again, what is the problem?

(OK, here's another one. In Holland we have a police warning during foggy weather. "Half you speed, double the distance..." There are always people who interprete that as "double your speed, half the distance..." ;-)


Boudewijn LutgeĀ®ink
http://www.vfpdevelopers-online.com
Women and Cats just do their own thing, men and dogs should relax and accept this fact of life.

COMPLETE THREAD

Best Strategy for Creating Unique ID Posted by Lenchz Negans @ 2/11/2008 2:43:24 AM
RE: Best Strategy for Creating Unique ID Posted by Ken Murphy @ 2/11/2008 3:47:37 AM
RE: Best Strategy for Creating Unique ID Posted by Lenchz Negans @ 2/11/2008 4:44:29 AM
RE: Best Strategy for Creating Unique ID Posted by Lyrad Bangoy @ 2/11/2008 6:14:41 AM
RE: Best Strategy for Creating Unique ID Posted by tushar @ 2/11/2008 7:30:57 AM
RE: Best Strategy for Creating Unique ID Posted by Ken Murphy @ 2/11/2008 12:45:17 PM
RE: Best Strategy for Creating Unique ID Posted by Christian Tabligan @ 2/11/2008 2:37:16 PM
RE: Best Strategy for Creating Unique ID Posted by Boudewijn Lutgerink @ 2/11/2008 4:44:52 PM
RE: Best Strategy for Creating Unique ID Posted by Lenchz Negans @ 2/12/2008 2:08:53 AM
RE: Best Strategy for Creating Unique ID Posted by Lyrad Bangoy @ 2/11/2008 4:14:05 AM
RE: Best Strategy for Creating Unique ID Posted by Lenchz Negans @ 2/11/2008 4:48:19 AM
RE: Best Strategy for Creating Unique ID Posted by Ken Murphy @ 2/11/2008 12:50:17 PM
RE: Best Strategy for Creating Unique ID Posted by Cetin Basoz @ 2/11/2008 12:35:01 PM
RE: Best Strategy for Creating Unique ID Posted by Ken Murphy @ 2/11/2008 12:54:15 PM
RE: Best Strategy for Creating Unique ID Posted by Cetin Basoz @ 2/11/2008 1:04:38 PM
RE: Best Strategy for Creating Unique ID Posted by Ken Murphy @ 2/11/2008 1:09:10 PM
RE: Best Strategy for Creating Unique ID Posted by Cetin Basoz @ 2/11/2008 1:16:39 PM
RE: Best Strategy for Creating Unique ID Posted by Ken Murphy @ 2/11/2008 4:04:12 PM
RE: Best Strategy for Creating Unique ID Posted by Cetin Basoz @ 2/12/2008 12:56:22 AM
RE: Best Strategy for Creating Unique ID Posted by Ken Murphy @ 2/12/2008 1:47:03 AM
RE: Best Strategy for Creating Unique ID Posted by Cetin Basoz @ 2/12/2008 4:18:54 PM
RE: Best Strategy for Creating Unique ID Posted by mike castillo @ 2/12/2008 3:16:26 AM
RE: Best Strategy for Creating Unique ID Posted by Cetin Basoz @ 2/12/2008 4:10:37 PM
RE: Best Strategy for Creating Unique ID Posted by Dale Dedoroy @ 2/11/2008 3:16:30 PM
RE: Best Strategy for Creating Unique ID Posted by Cetin Basoz @ 2/12/2008 12:59:49 AM