Board index » delphi » Char or Varchar ?
Henry
![]() Delphi Developer |
Henry
![]() Delphi Developer |
Char or Varchar ?2005-12-01 04:51:27 PM delphi103 What is the difference between Char and Varchar ? Is there any advantage to use varchar instead char ? Thank you. |
Martijn Tonies
![]() Delphi Developer |
2005-12-01 05:35:28 PM
Re:Char or Varchar ?QuoteWhat is the difference between Char and Varchar ? So storing "yes" in a CHAR(10) column will end up like this: "yes " when doing a SELECT. QuoteIs there any advantage to use varchar instead char ? Varchar takes 2 bytes (or so) more space cause it has to save the actual length of the data. So if you do a boolean-like column with possible values Y, N ->then use CHAR(1) (no spaces either way). For the rest, I would use VARCHAR. -- Martijn Tonies Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL Server Upscene Productions www.upscene.com Database development questions? Check the forum! www.databasedevelopmentforum.com |
Don Bowen
![]() Delphi Developer |
2005-12-01 08:33:24 PM
Re:Char or Varchar ?
"Henry" <XXXX@XXXXX.COM>writes:
QuoteWhat is the difference between Char and Varchar ? varchar(40) = 'Fred' = <stores 4 characters in file> char(40) = 'Fred' = <stores 40 characters in file> is this correct? |