Discussion:
what's the advantage of varchar type field over standard char type
(too old to reply)
Dinesh
2005-08-11 13:59:04 UTC
Permalink
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 12:16:50 UTC
Permalink
Hi Dinesh
Post by 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+varcharfield2 :-(

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 16:12:35 UTC
Permalink
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
Post by Dinesh
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 ???
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
Loading...