StarDust wrote:
Jono wrote:
GUID's are special type of ID's and, as you've guessed, not exactly what you're after |
So, are you trying to say that I can generate unique IDs without creating a GUID? How? Consider there will be performance issues.
Or, if it is impossible to generate unique IDs, is there a way to shorten the lenghth of a GUID? like, converting the GUID or some part of it to another value?
Your suggestion do helps me undertand where i am. Thank you very much for helping me through this and I look forward to get some more till I get a solution from you!
|
Hi Stardust,
I understand a bit better what you're trying to achieve. So let's make it a bit simpler for ourselves. As DJ's said, you can create your own Unique ID's, but you'll have to check them. Autonumbers are already checked, but they are squential, and not what you're after.
So, were back on to GUID's - yes, i know this is where you started, sorry about that.
I'm going to assume you're going to use SQL2005 (in one version or another) rather than writing two versions of your code. Here are some links about generating GUIDs:
The first link also shows some conversion options. Because the number is autogenerated, it's a 32 byte number and (i believe) the length cannot be changed. If you do want to represent it in a shorter fashion, you could try writing a routing to change the base.
For example hex is base 16 (0-9,A-F), but you could use base 36(0-9,A-Z) or some other base [base62 - 0-9,A-Z,a-z - this get more complicated!]. I did write a converter in Pascal as a college project, but that was ages ago!
I think the NEWID() function is the way forward for you, but let us know what you think.
Jono