Varchar Field Type
| Visual FoxPro 9.0 SP2 |
| Varchar Field Type |
| See Also |
|
To include alphanumeric text in fields without including additional padding with spaces or truncating trailing spaces, use the Varchar type. Alphanumeric text can contain letters, numbers, spaces, symbols, and punctuation. The Varchar type also provides a convenient method for mapping SQL Server Varchar types to corresponding Visual FoxPro data types.
To prevent data in Varchar fields from being translated across code pages, use the Varchar (Binary) type.
The Varchar and Varchar (Binary) field types are similar to the Character data and Character (Binary) field type in that you can store text information that is not used in mathematical calculations, such as names, addresses, and numbers. When storing Varchar and Varchar (Binary) values in variables, they are treated as Character types.
Tip |
|---|
|
To create a Varchar (Binary) field in a table, use the NOCPTRANS option in the SQL CREATE TABLE and CREATE CURSOR commands or select it in the Fields tab in the Table Designer. |
The Varchar and Varchar (Binary) field types have priority over the Character type when performing UNION and concatenation operations between these types. For example, suppose you have Varchar (X) and Character (Y) fields with X representing the length of character value stored in the Varchar field and Y representing the length of the Character field. When performing concatenation operations, the result is a Varchar field with a character value length of X+Y.
When performing concatenation operations between Varchar (Binary) (X) and Character (Binary) (Y), the result is Varchar (Binary) (X+Y). For Visual FoxPro functions that return Character values, if at least one parameter is a Varchar or Varchar (Binary) field in a table or cursor, the return type is Varchar. For more information about data type conversion and precedence in UNION operations, see Considerations for SQL SELECT Statements.
Index keys based on Varchar and Varchar (Binary) fields or expressions are padded with spaces from the right of the value to the maximum length of the field. Therefore, LIKE clauses in SQL join and filter conditions with a Varchar or Varchar (Binary) field can be only partially Rushmore-optimized. For more information, see Using Rushmore Query Optimization to Speed Data Access.
Support for Varchar and Varchar (Binary) Types
See Also
© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic
Tip
Microsoft Visual FoxPro 9 SP2 Help file, VFPX Edition v1.08