Compartilhar via


Char or Varchar? - You Decide (by John Koziol)

New to VFP 9 is behavior when a function is used in a SELECT statement that produces a character string. So, for example:

SELECT LEFT(name,10) FROM people

Prior to VFP 9, this would result in the character field “name“.  New to VFP 9 is storing the data to a Varchar field.

Admittedly, this could create some legacy issues, hence, the following new SET:  SET VARCHARMAPPING ON | OFF. If OFF, legacy behavior is unchanged.  When ON, expressions in a SELECT will yield varchar.

Comments

  • Anonymous
    July 13, 2004
    How does the VarChar type affect performance? I thought the fixed-length Char type was one of the reasons Rushmore was so fast.
  • Anonymous
    July 13, 2004
    Just wondering. What would be faster: "set varcharmapping on" or a SQL - Select with the new cast() function. My guess is the former. Am I right?
  • Anonymous
    July 15, 2004
    First to Steve: Not sure although that makes for an interesting test scenario. I'll look into it.

    Boudewijn: Looking things over, not much of a difference I would anticipate. However, I'll investigate.
  • Anonymous
    November 08, 2007
    PingBack from http://foxpro.ntsl119.com/scr/archives/242