Export (0) Print
Expand All
Expand Minimize
3 out of 3 rated this helpful - Rate this topic

SET COLLATE Command

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


SET COLLATE TO cSequenceName

Parameters

cSequenceName

Specifies a collation sequence. The following table lists collation sequence options that are available.

cSequenceName Language

ARABIC

Arabic

CZECH

Czech

DUTCH

Dutch

GENERAL

English, French, German, Modern Spanish, Portuguese, and other Western European languages

GERMAN

German phone book order (DIN)

GREEK

Greek

HEBREW

Hebrew

HUNGARY

Hungarian

ICELAND

Iceland

JAPANESE

Japanese

KOREAN

Korean

MACHINE

Machine (the default collation sequence for earlier FoxPro versions)

NORDAN

Norwegian, Danish

PINYIN

Simplified Chinese

POLISH

Polish

RUSSIAN

Russian

SLOVAK

Slovak

SPANISH

Traditional Spanish

STROKE

Simplified and traditional Chinese

SWEFIN

Swedish, Finnish

THAI

Thai

TURKISH

Turkish

UNIQWT

Unique Weight

NoteNote

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

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

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

For more information on configuring Visual FoxPro, see Customizing the Visual FoxPro Environment and Special Terms for Configuration Files.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.