MySQL

Matthew Godycki mcg2-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org
Mon Jul 20 17:14:22 UTC 2009



I came across this (http://dev.mysql.com/doc/refman/5.0/en/char.html) and
>>if you are using MySQL 5.0.3 or newer (which I am) then the length can be
>>up to 65535.
>
>>Is there any reason to use varchar2 over varchar or vice versa?

> Another difference is varchar always pad stuff if the maximum length was not utilized, while varchar2 allow for variable size. 
> What I mean by that is, if you are using varchar and you insert 10, I think its saved as 010 where 255 is the maximum size. 
> varchar2 does not handle it that way though. If you insert 10, it does not save 00010, but just 10

You've got the ride idea  but the details are wrong.  Varchar pads with spaces, not with 0's.
These days, basically always use varchar2 unless you're only storing a one-character flag,
in which case it's easiest to use char.

-M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gtalug.org/pipermail/legacy/attachments/20090720/d9c95562/attachment.html>


More information about the Legacy mailing list