Re: Selecting alphanumeric combinations that do not exist already in table?????



rbr (ryankbrown@xxxxxxxxx) writes:
I have considered the speed and space issues. Unfortunately, there are
over 14 million usernames currently in use and another 10 million
reserved for currently inactive customers. The process of generating
names and checking if they are taken is getting tougher. The idea my
boss had was to create a table (once) of unused usernames and randomly
pick one from the list each time. If this is not feasible (you all
make very good points) I would be more than happy to tell him so.
However, I figured it would be worth investigating before saying it
was impossible.

Impossible it isn't. But it's definitely a waste of disk space.

Even if you have 24 million codes already taken, that's only a little
more than 1% of the total space consumed, so I think that if every time
you need a code, generate a random code, check if it is in use this
should be efficient enough. For about each 10000 customer you will have
to generate three codes before you have an unused code.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: Selecting alphanumeric combinations that do not exist already in table?????
    ... boss had was to create a table of unused usernames and randomly ... you need a code, generate a random code, check if it is in use this ... Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books ... ...
    (comp.databases.ms-sqlserver)
  • RE: Urgent problem about SQL Server
    ... step as being wrong somehow. ... have scratch their hair over usernames, ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.security)
  • Re: Selecting alphanumeric combinations that do not exist already in table?????
    ... generated username that is a 6 character, alphanumeric, field. ... usernames are randomly generated by code. ... Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books ... ...
    (comp.databases.ms-sqlserver)
  • RE: Audit Table
    ... want to record and return the current login username to certain table in ... SQL Server, when you performed insert or update action. ... Which authentication do you choose to log on IIS? ... So far as I know, if we want to record the usernames used for SQL Server, ...
    (microsoft.public.sqlserver.security)
  • Re: Is there any way to find out username pwd in Access
    ... If Access allowed obtaining the user's password through the programming ... for that reason. ... >for Sql server logon? ... >sql server usernames and passwords. ...
    (microsoft.public.access.adp.sqlserver)