|
Home > Archive > FoxPro database connector > August 2005 > re: what's the advantage of varchar type field over standard char type
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
re: what's the advantage of varchar type field over standard char type
|
|
| Dinesh 2005-08-11, 1:29 pm |
| hi,
how is varchar type field definining useful over standard character type
fields.
i thought varchar types would save diskspace but infact it is increasing the
physical size of the dbf ???
i have dbf of @ 600,000 records with each record of @ 1300 record length.
the entire file size is @ 700mb.
earlier i had some fields of type 'memo'. that had a file size of @ 600mb.
so in fact my SQL commands give result more quick with memo type fields than
having either character or varchar type fields.
is there any way i can get rid of memo type fields and at the same time have
quicker processing of my SQL commands.
thanks in advance.
regards,
dinesh
| |
| Kurt Grassl 2005-08-12, 7:25 am |
|
Hi Dinesh
>
> how is varchar type field definining useful over standard character type
> fields.
>
> i thought varchar types would save diskspace but infact it is increasing
> the
> physical size of the dbf ???
No, i thought this too, but varchar are almost the same like char - the
difference is:
FoxPro saves in the last byte the length of the string. There is an extry
byte at the end of each record with one bit for each varchar field which is
set, when a varchar-field is full.
You can use varchar (in contrast to memos) in group by-clauses und easy use
in indexes. Well, "easy" ... think about varcharfield1+varcha
rfield2 :-(
With varchar you have less xTRIM when you read data
prename + " " + name
instead of
rtrim(prename) + " " + rtrim(name)
or
rtrim(reduce(prename
+ " " + name))
.. but you perhaps have to trim when writing into the dbf.
Without saving discspace varchar is far less cool than i thought when vfp 9
came out.
regards
Kurt
| |
| Dan Freeman 2005-08-12, 11:25 am |
| VarChar is mostly for compatibility with database servers. VFP is no longer
a menace to enterprise data. <g>
Think about it a bit: if the server has a empty Varchar field and you run a
query, the varchar field used to be represented in VFP a char, and filled
with spaces. When sending an update, VFP defaulted to sending all the spaces
back even if the field started out empty on the server.
Now that VFP "knows about" Varchar, it also "knows about" how to send
updates to the back end.
Dan
Dinesh wrote:
> hi,
>
> how is varchar type field definining useful over standard character
> type fields.
>
> i thought varchar types would save diskspace but infact it is
> increasing the physical size of the dbf ???
>
> i have dbf of @ 600,000 records with each record of @ 1300 record
> length.
>
> the entire file size is @ 700mb.
>
> earlier i had some fields of type 'memo'. that had a file size of @
> 600mb.
>
> so in fact my SQL commands give result more quick with memo type
> fields than having either character or varchar type fields.
>
> is there any way i can get rid of memo type fields and at the same
> time have quicker processing of my SQL commands.
>
> thanks in advance.
>
> regards,
> dinesh
|
|
|
|
|