How to create an "activation code" and store it in sql server 2005 database?

  • Thread starter Thread starter Andy B
  • Start date Start date
A

Andy B

I am making a web application that would randomly create an activation code
and put it in a database. The web application would then send it in an email
to the user with a link to go to and enter the activation code. How would I
do this? and what sql server data type would I use? I want the activation
code to be no longer than 12 characters, have a mix of numbers and letters
and have no special symbols.
 
I am making a web application that would randomly create an activation code
and put it in a database. The web application would then send it in an email
to the user with a link to go to and enter the activation code. How wouldI
do this? and what sql server data type would I use? I want the activation
code to be no longer than 12 characters, have a mix of numbers and letters
and have no special symbols.

System.Guid would be the easiest in my opinion.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
System.Guid would be the easiest in my opinion.

Thanks,

Seth Rowe [MVP]http://sethrowe.blogspot.com/

Though I neglected to read the "no longer than 12 characters" part.
Oops.

The benefit of using System.Guid (or Unique Identifier in SQL) is that
you could have SQL Server create the Guids for you and not have to
worry about handling duplicate activation codes. Though if the 12
character rule is a must, this benefit is negated.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
Couldn't you have sql server take a sub set of characters of the guid it
creates and use that instead?


System.Guid would be the easiest in my opinion.

Thanks,

Seth Rowe [MVP]http://sethrowe.blogspot.com/

Though I neglected to read the "no longer than 12 characters" part.
Oops.

The benefit of using System.Guid (or Unique Identifier in SQL) is that
you could have SQL Server create the Guids for you and not have to
worry about handling duplicate activation codes. Though if the 12
character rule is a must, this benefit is negated.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
Couldn't you have sql server take a sub set of characters of the guid it
creates and use that instead?




Though I neglected to read the "no longer than 12 characters" part.
Oops.

The benefit of using System.Guid (or Unique Identifier in SQL) is that
you could have SQL Server create the Guids for you and not have to
worry about handling duplicate activation codes. Though if the 12
character rule is a must, this benefit is negated.

Thanks,

Seth Rowe [MVP]http://sethrowe.blogspot.com/

You'd run a greater risk of getting duplicates is all.

Thanks,

Seth Rowe [MVP]
http://sethrowe.blogspot.com/
 
I think that a 25 digit guid can be converted from 25 characters of
Hex.. to what is it, 16 characters of Alpha-Numeric?
 
Back
Top