Hi all,
I might be getting this all wrong but bear with me.
I need to create some kind of Unique field in my DB that isnonsequential. This is because I need it to be difficult to guessids if you have an example in front of you.
I have looked at8digit EAN codes which include a check digit system.( I use a base digit of the row_id for these) Can anyone tell mehow many uniques I can get out of this system?
For my ID: I have looked at something along the lines of:
Hex(row_id) + "T" + Hex( Trimmed(EAN)) The "T" serves to split the numbers for when I am converting back.
So for example:
row_id EAN_code Hex(row_id) + "T" + Hex( Trimmed(EAN) )
---------------------------
3166 00031663 C5ET7BAF
3167 00031673 C5FT7BB9
3168 00031686 C60T7BC6
Is this too easy to guess (once you can tell there are two hex numbers there?)
What do people think?
Thanks,
Pete
Hi Pete,
Based on your description, I understand that you need a field in the databasae table, which is generated automatically. It has to be unique and non-sequential.
In this case, I would suggest the UniqueIdentifier data type. It is a GUID value and can be generated with NEWID() function.
Here are some more information about this data type:
http://msdn2.microsoft.com/en-us/library/ms187942.aspx
HTH. If this does not answer you question, please feel free to mark it as Not Answered and post your reply. Thanks!
|||Hi Kevin,
Sorry, once again I have forgotten to post somepretty vital information! However, I didnt know about SQLGUID so thanks anyway!
The limitation on the ID I requireis that it needs to be typed into a text message (SMS) so I'm trying tokeep it as short as possible.
Does anyone know of any suchnumbering systems? I think anything between 8-14 chars would beperfect. (I realise that we may have anything up to amillion records so the number of chars in the ID will go up - or atleast - Any leading zeros will be removed)
Thanks again,
Pete
|||
Hi Pete,
Sorry for my ignorance, but I don't know any ID system like that. May the the other community member has some idea on this.
|||Cheers Kevin, maybe I'm just looking for a Silver Bullet!
No comments:
Post a Comment