Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dev45
Yak Posting Veteran
54 Posts |
Posted - 2009-03-28 : 13:59:09
|
Hi,i was asked to create a procedure for creating 10 digit unique numbers. The numbers can be produced with different runs of the procedure, for example in the first run we can create 100.000 numbers, in the second run 100.000 more, in the third 50.000 etc...We need the numbers to be unique and "uncrackable". Is there an algorithm that acts like that ? I have come with the following logic : - create an 8 digit sequential number- create two check digits using ABS(CHECKSUM(NewId())) % 10 - concatenate the two check digits to the end of the 8 digit number. This way i can control uniqueness of the number (since i control the sequential part of the number) and i think that the two check digits make it almost difficult for someone to guess the whole number (0.01 possibility). My question is the following : suppose someone has 100.000 numbers in his possession. Is it possible that he can reproduce the way that SQL Server is producing the check digits ??(I ve seen that newID is a GUID using the MAC Address of the network card plus the date/time that the GUID was created...)Thx in advance theodore |
|
|
|
|
|