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

Published 13 July 04 02:26 AM

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.

 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# SteveC said on July 13, 2004 6:52 PM:
How does the VarChar type affect performance? I thought the fixed-length Char type was one of the reasons Rushmore was so fast.
# Boudewijn Lutgerink said on July 14, 2004 5:16 AM:
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?
# John Koziol said on July 16, 2004 1:37 AM:
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.
# foxpro.catalyst ?? » Blog Archive » workBLOGS . work varchar and .NETRocks072 said on November 8, 2007 3:59 PM:

PingBack from http://foxpro.ntsl119.com/scr/archives/242

Leave a Comment

(required) 
(optional)
(required) 

  
Enter Code Here: Required

This Blog

Syndication

Page view tracker