[thelist] preventing duplicate randomly generated ID's was: SQL 2000 auto create ID's

Chris W. Parker cparker at swatgear.com
Tue Aug 27 17:57:00 CDT 2002


i know i'm coming late to this thread but how do you handle duplicates?
although duplicate passwords aren't too much of problem, there is a
problem with duplicate IDs.

i was thinking you could create the ID, check a table to see if that ID
already exists. if it does, create a new ID and check again until a
match isn't found. once a unique ID is created (i.e. no matching IDs
found in the db) you insert that new ID so that it can be recorded as
being used.

did anything about ingrid's original email indicate that this isn't
necessary and i just didn't notice it? otherwise, what other ways can
this be done?

now that i think about it a little more. would it be better to
originally pull out every created ID in the db and then search, let's
say an array of IDs for the newly generated ID? would that be faster
than pulling one record at a time and checking (assuming it doesn't
succeed on the first try)?


chris.



More information about the thelist mailing list