News:

Join the Facebook Fan Page.

Main Menu

TINYTEXT and VARCHAR

Started by Anguz, December 09, 2004, 08:06:19 AM

Previous topic - Next topic

Anguz

What's the difference between TINYTEXT and VARCHAR(255)?

Sorry if this is a silly question. :-\
Cristián Lávaque http://cristianlavaque.com

[Unknown]

I'm actually not totally sure, except that varchar removes trailing spaces and tinytext does not.

-[Unknown]

Parham

that's actually exatly it.  (I'll write not from a mysql viewpoint, but rather from a DB2 viewpoint).  TINYTEXT add extra spaces to make up for spaces not used (and it will return those spaces with queries), while VARCHAR will return the TRIM'ed version of text you entered.  this becomes troublesome when doing comparisons using LIKE and =:

'Someone ' = 'Someone     ' is true, but
'Someone ' LIKE 'Someone     ' is false.

Advertisement: