ACC: MS Access May Choose an Unexpected Index as the Primary KeyLast reviewed: September 25, 1997Article ID: Q169777 |
The information in this article applies to:
SYMPTOMSModerate: Requires basic macro, coding, and interoperability skills. When you link (attach) a table from an ODBC data source, such as Microsoft SQL Server or ORACLE, and that table contains more than one unique index, Microsoft Access may select the wrong index as the primary key.
CAUSEWhen you link a table from an ODBC data source, such as Microsoft SQL Server and ORACLE, the Microsoft Jet database engine makes a call to SQLStatistics, an ODBC API function used to identify the first unique index to select as the primary key. SQLStatistics returns index information in the following order: Clustered, Hashed, Non-clustered or other indexes. In addition, each index is listed alphabetically within each group. NOTE: All indexes created within ORACLE are treated as non-clustered indexes. Therefore, the order of the index is determined by the name rather than by type.
RESOLUTIONTo ensure that the Jet database engine properly selects the desired index as the primary key when linking the table from your ODBC back-end, you can rename the index so that it appears first alphabetically. NOTE: When using SQL Server version 6.x, this behavior only occurs if you are using non-clustered unique indexes.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce Behavior
REFERENCESORACLE is manufactured by Oracle Corporation, a vendor independent of Microsoft; we make no warranty, implied or otherwise, regarding this product's performance or reliability.
|
Additional query words: indexes
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |