Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How long is a guid

Posted on 2006-03-23
10
Medium Priority
?
1,969 Views
Last Modified: 2011-10-03
I am generating a GUID and need to store this value in a db table. How long does the varchar datatype need to be to hold this value ?
0
Comment
Question by:nmretd
7 Comments
 
LVL 35

Expert Comment

by:mrichmon
ID: 16271735
Depends on the GUID, but is usually a 128 bit number.  Therefore you need at least 128 and then some GUIDs have dashes or spaces to break it up into more readable sections - hence that is shy I said it depends.  I would say that 150 should be plenty for all cases.
0
 
LVL 4

Accepted Solution

by:
SmithJW earned 100 total points
ID: 16271757
http://en.wikipedia.org/wiki/GUID

A GUID is 16-bytes (128-bits) written in hex

    3F2504E0 4F89 11D3 9A 0C 03 05 E8 2C 33 01

GUIDs are written using a four-byte word, 3 two-byte words, and a six-byte word, such as:

    {3F2504E0-4F89-11D3-9A0C-0305E82C3301}
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 100 total points
ID: 16271838
In most generators they are written as SMithJW showed which is generally 32 characters excluding spaces and dashes and brackets and other divider characters.  If your generator does that then you should only need about 50 characters for the max case.  But my first post covered worst case scenario.

However, I recommend testing your generator and then going off of that.  It should be consistent each time from teh same generator.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:SmithJW
ID: 16271871
It is safe to remove any formatting characters i beleive, as they are in the same position for every GUID... at least that was my interpretation of them, i could be wrong...
If im right though, id seperate just the meaningful data to save space.
but yeah, as richmon says, test the generator and handle it from there.
0
 
LVL 41

Expert Comment

by:graye
ID: 16271874
Have you considered storing the GUID as a "GUID-type" in the database (rather than a string)?   Most databases natively support a GUID type
0
 
LVL 13

Expert Comment

by:devsolns
ID: 16272338
As your probably aware,

System.Guid guid = System.Guid.NewGuid();
0
 
LVL 35

Expert Comment

by:mrichmon
ID: 16566225
Split SmithJW {16271757} & mrichmon {16271838} & graye{16271874} & devsolns {16272338}
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Integration Management Part 2
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question