SET COLLATE Command
Specifies a collation sequence for character fields in subsequent indexing and sorting operations.
Specifies a collation sequence. The following table lists collation sequence options that are available.
English, French, German, Modern Spanish, Portuguese, and other Western European languages
German phone book order (DIN)
Machine (the default collation sequence for earlier FoxPro versions)
Simplified and traditional Chinese
When you specify the SPANISH option, "ch" is a single letter that sorts between "c" and "d", and "ll" sorts between "l" and "m". If you specify a collation sequence option as a literal character string, be sure to enclose the option in quotation marks:
SET COLLATE TO "SWEFIN"
MACHINE is the default collation sequence option and is the sequence FoxPro users are familiar with. Characters are ordered as they appear in the current code page. The MACHINE collation sequence provides the best performance. Using a collating sequence other than MACHINE may reduce performance primarily in comparison and indexing operations, and may create larger index files.
GENERAL might be preferable for U.S. and Western European users. Characters are ordered as they appear in the current code page. In FoxPro versions earlier than 2.5, you might have used UPPER( ) or LOWER( ) on character fields when you created indexes. In FoxPro versions later than 2.5, you can specify the GENERAL collation sequence option and omit the UPPER( ) conversion instead.
If you specify a collation sequence option other than MACHINE, and if you create an .idx file, a compact .idx is always created.
Use SET("COLLATE") to return the current collation sequence.
If you include the following line in your Visual FoxPro configuration file, a collation sequence is specified when you start Visual FoxPro:
COLLATE = cSequenceName
This is identical to issuing the following command:
SET COLLATE allows you to order tables containing accented characters for any of the supported languages. Changing the setting of SET COLLATE doesn't affect the collating sequence of previously opened indexes. Visual FoxPro automatically maintains existing indexes, providing the flexibility to create many different types of indexes, even for the same field.
For example, if an index is created with SET COLLATE set to GENERAL, and the SET COLLATE setting is later changed to SPANISH, the index retains the GENERAL collation sequence.
SET COLLATE is scoped to the current data session.
When using the SET COLLATE TO command, you may receive the error "Collating sequence <sequencename> is not found." This occurs when you attempt to use a collating sequence that is not supported by the current code page. To prevent this error, you must specify a compatible code page in your Visual FoxPro configuration file. For instance, you may see the error "Collating sequence 'CZECH' is not found" when issuing the command SET COLLATE TO 'CZECH'. To enable support for the Czech collating sequence, add the following line to your config.fpw file and restart Visual FoxPro:
CODEPAGE = 1250