Anzure
Anzure

Reputation: 994

Varchar character length

I want to store an unique ID in my MySQL databse, but I need to know how long the X in varchar(X) should be.

The character length I need is 36 characters, example of an unique ID I use: 883db600-3512-4124-8cd5-5bd051f137fe

Upvotes: 1

Views: 475

Answers (2)

T McKeown
T McKeown

Reputation: 12847

A typical guid is 38 bytes (if you are counting the curlies).

More info: How many characters are there in a GUID?

char(38) or char(36)

Upvotes: 0

juergen d
juergen d

Reputation: 204746

If it is always 36 characters long then use

char(36)

if it can be shorther then

varchar(36)

Upvotes: 2

Related Questions