Tuesday, 27 August 2013

Generate unique code from primary key

Generate unique code from primary key

I have a table of orders and I want to give users a unique code for an
order whilst hiding the incrementing identity integer primary key because
I don't want to give away how many orders have been made.
One easy way of making sure the codes are unique is to use the primary key
to determine the code.
So how can I transform an integer into a friendly, say, eight alpha
numeric code such that every code is unique?

No comments:

Post a Comment