Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating a unique key

Status
Not open for further replies.

shweta

Technical User
Mar 20, 2001
27
US
Hi,

We take the email of the user as an input and need to generate a unique 10-character key from this email. The logic to generate the key should be such that the next time it is used the same key is generated for the same email address. The key can be alphanumeric, but at most 10 characters.

Any ideas, suggestions?

Thanks,
Shweta
 
You could store the email in a table with an auto-increment column in it. Key the table on Email address.

When adding a new address, you'd do a SELECT on it first to see if it already exists.

10 characters would give you room for about a 10 billion addresses, which should be sufficient :)

Chip H.
 
Thanks ChipH!

We decided to implement it using a similar solution...

-Shweta
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top