Character Data Type

To store alphanumeric text, such as letters, numbers, spaces, symbols, and punctuation, use the Character data type. To prevent data in Character fields from being translated across code pages, use the Character (Binary) field type.

Tip

To create a Character (Binary) field, use the NOCPTRANS option in the SQL CREATE TABLE and CREATE CURSOR commands or select it in the Fields tab in the Table Designer.

Character fields or variables and Character (Binary) fields can store text information that is not used in mathematical calculations, such as names, addresses, and numbers. For example, phone numbers or zip codes, though they include mostly numbers, are actually best stored as character values.

If the value stored in a Character field is smaller than the width of the field, Visual FoxPro inserts additional spacing to the right side of the value in the field up to the maximum width of the field. Trailing spaces are truncated. To store alphanumeric text in fields without additional padding or truncating trailing spaces, use the Varchar field type instead. Fields with Varchar and Varchar (Binary) type have priority over the Character type in UNION and concatenation operations. For more information, see Varchar Field Type and Considerations for SQL SELECT Statements.

For specifications about the Character data type and the Character (Binary) field type, see Visual FoxPro Data and Field Types.

See Also

Tasks

How to: Choose Data Types

Reference

Character Operators
CREATE TABLE - SQL Command
Creating Character Expressions

Other Resources

Data and Field Types