Forum Discussion
Bryan Valencia
Oct 11, 2023Copper Contributor
Short Unique IDs
I need to create "Student ID's" that are unique, not sequential numbers, and not GUIDs. Ideally, they would be easy to remember, so uppercase+numbers, and 7 to 10 digits long. I tried "ASCII-ifying" Guids, but the numbers were still horribly long.
I have seen some documents online that use a format like ?ID=AZ9DF6J3Z. is there any way to generate numbers like this, but guarantee uniqueness?
- olafhelperBronze Contributor
that are unique, not sequential numbersBryan Valencia , why not sequential?
Add an IDENTITY column or one filled with a sequence value = sequential number.
Add a calculated column for the string format in mind or a trigger calcualting the format.
- Bryan ValenciaCopper ContributorBecause let's say you're "Bob", student 1132. The URL to your student page looks like...
https://site.com/students/1132
This makes it INCREDIBLY easy to just edit the URL and get private data you have no business seeing. GUIDS are WAY TOO LONG. I was planning to use the IDs to put on a Student ID card, something like "AY67Z9"- something non-sequential, yet unique, and easy to remember.
So far, my best idea is to take "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" and randomly choose characters, then query the database to see if it's already in use. Workable, but CLUNKY as He||.