You are here: Re: [PHP] novice: char to varchar « PHP « IT news, forums, messages
Re: [PHP] novice: char to varchar

Posted by "Richard Lynch" on 11/02/58 11:16

On Wed, May 18, 2005 11:15 am, tony yau said:
> Hi all,
>
> I try to do the following:
>
> CREATE TABLE IF NOT EXISTS Invoice(
> PKey INTEGER,
> Received DATETIME,
> Cost DECIMAL(10,2),
> FileName VARCHAR(50),
> RefNum CHAR(10),
>
> PRIMARY KEY (PKey)
> ) TYPE=MyISAM COMMENT='Invoice Data';
>
> but it keep generating RefNum VARCHAR(10) instead of CHAR(10)
>
> I don't understand, please help (or point me to RTFM page)

WILD GUESS!!!

In *some* impelementations of SQL, the performance benefit of CHAR over
VARCHAR is lost after the first VARCHAR column.

In other words, it's making it VARCHAR because there is NO benefit to it
being CHAR because there is a column earlier (FileName) that is already
VARCHAR.

Try moving the RefNum to be *before* the FileName column.

If that fixes it, you're all set.

I don't know if MySQL is such an implementation. I don't know if MySQL's
VARCHAR and CHAR have any difference at all in MyISAM. I don't know...
There's a lot I don't know. The above was all just guess-work based on
other SQL implementations. http://mysql.com should document what's
happening and why. Search for VARCHAR and CHAR there, and you should find
it.

--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация