SET COLLATE Command

See Also

Specifies a collation sequence for character fields in subsequent indexing and sorting operations.

Syntax

SET COLLATE TO cSequenceName

Arguments

cSequenceName

Specifies a collation sequence. The following collation sequence options are available.

Options Language
DUTCH Dutch
GENERAL English, French, German, Modern Spanish, Portuguese, and other Western European languages
GERMAN German phone book order (DIN)
ICELAND Icelandic
MACHINE Machine (the default collation sequence for earlier FoxPro versions)
NORDAN Norwegian, Danish
SPANISH Traditional Spanish
SWEFIN Swedish, Finnish
UNIQWT Unique Weight

Note   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 Xbase users are familiar with. Characters are ordered as they appear in the current code page.

GENERAL may 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 may have used UPPER( ) or LOWER( ) on character fields when you created indexes. In FoxPro versions later than 2.5, you can instead specify the GENERAL collation sequence option and omit the UPPER( ) conversion.

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 TO cSequenceName

Remarks

SET COLLATE enables 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.

For additional information on code pages and Visual FoxPro's international support, see Code Pages Supported by Visual FoxPro in Chapter 18, Developing International Applications, in the Programmer's Guide.

For more information on configuring Visual FoxPro, see Chapter 3, Configuring Visual FoxPro, in the Installation Guide.