Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Create unique GUIDs - need help
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Create unique GUIDs - need help

 Post Reply Post Reply Page  12>
Author
StarDust View Drop Down
Senior Member
Senior Member


Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarDust Quote  Post ReplyReply Direct Link To This Post Topic: Create unique GUIDs - need help
    Posted: 11 August 2008 at 2:57am
I want to create unique IDs for my members which will be 6 chars long and will be prefixed by alphabets.

Example: ft8795

Does anyone know which is the better way to do this?
Back to Top
Jono View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 18 September 2006
Location: United Kingdom
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jono Quote  Post ReplyReply Direct Link To This Post Posted: 11 August 2008 at 7:35pm
Hi StarDust,
 
Is it completly random or the next in a sequence? (i.e. aa0000, aa0001, etc.) Either way, I suspect you'd need to generate an ID and then query the database to make sure it's not in use. It's possible to do this in a stored procedure if you're using MS SQL.
 
It is for use in WWF or a different application?
 
Jono
Back to Top
StarDust View Drop Down
Senior Member
Senior Member


Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarDust Quote  Post ReplyReply Direct Link To This Post Posted: 12 August 2008 at 1:44am
Thank you Jono for replying.

Actually I have little knowledge in this part.

I learned that using Server.CreateObject("Scriptlet.TypeLib") or stored procedures I can create GUIDs. I found couple of other functions that says that generate GUIDs. But my problem is I never worked with GUIDs.

Actually I need unique IDs for couple of things. Currently I am working on a system that requires unique order ids, receipt ids, event ids and member ids. My problem is I cannot just generate integer autonumbers and assign them as IDs - like the author_ID in WWF. I need strings prefixed by alphabets. And I do not know which way to go.

Another thing I am considering is a GUID string is not short in length. If a shorter length unique IDs can be created, say 6 to 10 chars long, it will be better - or is it impossible? But I cannot just depend on the system timer and create simple IDs because I cannot take the risk to generate duplicate values.

It is new to me and I am confused what to follow.

It is not for WWF and I plan to script the whole application in Access and then port it to MS SQL.


Back to Top
StarDust View Drop Down
Senior Member
Senior Member


Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarDust Quote  Post ReplyReply Direct Link To This Post Posted: 12 August 2008 at 1:46am
Access for testing and MS SQL in the development.
Back to Top
StarDust View Drop Down
Senior Member
Senior Member


Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarDust Quote  Post ReplyReply Direct Link To This Post Posted: 12 August 2008 at 1:50am
Ow, missed again, sorry.

I guess a sequential unique ID could be a security risk because anyone can guess what's after or before the sequence.


Originally posted by Jono Jono wrote:

Either way, I suspect you'd need to generate an ID and then query the database to make sure it's not in use.


But this way, there might be loops and the database will be huge after 1 year of use. The whole thing is a business application. So, querying the database can be a performance issue. Note, I have to generate unique Ids not only for my members but there are other Ids also.
Back to Top
Jono View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 18 September 2006
Location: United Kingdom
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jono Quote  Post ReplyReply Direct Link To This Post Posted: 12 August 2008 at 7:20pm
Have you considered using the "autonumber" feature of the database and then prefixing an identifier infront of it? For example each invoice would have a unique ID in the database, but when it's printed (screen or paper), you could append INV and leading zero's: e.g. INV000023 - this eliminates the requirement to check for a unique ID.
 
You may also want to look at SQL Express - it's free and ideal for a development environment and without the need to modify code from Access to SQL Server.
 
I appreciate what you're saying about guessing ID's in a sequence, but it's bad to have "security by obsecurity" - if someone, for example, want's to view an invoice, it should either be their invoice or they should be a sys admin, otherwise they should be directed to another page.
 
GUID's are special type of ID's and, as you've guessed, not exactly what you're after.
 
I hope the above helps, but let me know if i can clarify anything for you.
Back to Top
StarDust View Drop Down
Senior Member
Senior Member


Joined: 14 May 2007
Location: Bangladesh
Status: Offline
Points: 310
Post Options Post Options   Thanks (0) Thanks(0)   Quote StarDust Quote  Post ReplyReply Direct Link To This Post Posted: 12 August 2008 at 7:42pm
Jono, thanks for your reply.

Originally posted by Jono Jono wrote:

....if someone, for example, want's to view an invoice, it should either be their invoice


Right Jono. But it's not about viewing an invoice or order, actually there are other issues. I do not want someone guess an order number or a support ticket number or a reference number. Because some numbers(like orders and references) will be used in some hard copied docs of the company. And if someone can guess those numbers, he might be able to guess some information even have access to some information phisically or ver the phone that the company might not want to expose. And if it happens somehow, ultimately the headache will come on to me. Look we all know business men are not that much IT aware. So, it is pretty possible getting more information from a normal staff by only providing an order number and the reference number to that order. So I need those as non sequential.

Originally posted by Jono 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!Smile
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 13 August 2008 at 8:41pm
hi,
 
i see what you want regarding security , you can use prefixes and hex values and timers
 
 
INV-AccID-RANDOMNumber(5)
 
and using a MOD 2 = 0 function within the random number function. using your Acc to randoimise the sections being used like SECOND(NOW()), and Value = round(odd/Second)
and depending on that use different MOD 3 = 3 or others to create random
 
and place into a DB
 
just a few ideas , simular with my security measures i use in my Apps (require to be secure)
 
Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.