How to Create a Primary Index in a Visual FoxPro ProgramID: Q130601 3.00 WINDOWS The information in this article applies to:
SUMMARYMicrosoft Visual FoxPro has a new index type, Primary. The Primary index, however, cannot be created in a program by using the INDEX command. This article shows by example how to add or modify a Primary index in a program.
MORE INFORMATIONA Primary index is an index that never permits duplicate values on the specified field or expression. The Primary index may be established in the database container interface or in a program by using the CREATE TABLE or ALTER TABLE command. A table with a Primary index must be part of a database and cannot be a free table. The first example shows how to create a table with a Primary index. The second example shows how to alter an existing table to change a Primary key. The third example adds a Primary index to an existing table.
Example 1 - Create a New Table with a Primary Index1. Create a new database, or open an existing one. 2. Issue the following command in the Command window to create a table with
Example 2 - Modify an Existing Table to change a Primary Index1. Open the database used in example 1. 2. Issue the following command from the Command window to move the Primary
Example 3 - Modify an Existing Table to add a Primary Index1. Add a new table to an existing database with this command:
2. From the Command window, add a Primary index to the existing table by
Additional reference words: 3.00 VFoxWin
KBCategory:
KBSubcategory: FxprgTable
|
Last Reviewed: May 22, 1998 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |