大网数据广告活动
磁盘与文件系统

JetCreateIndex3 Function

· 52CE 我爱测

Learn more about: JetCreateIndex3 Function

Applies to: Windows | Windows Server

JetCreateIndex3 Function

The JetCreateIndex3 function creates indexes over data in an ESE database, which can be used to locate specific data quickly.

Windows 7:  JetCreateIndex3 is introduced in the Windows 7 operating system.

    JET_ERR JET_API JetCreateIndex3(
      __in          JET_SESID sesid,
      __in          JET_TABLEID tableid,
      __in          JET_INDEXCREATE2* pindexcreate,
      __in          unsigned long cIndexCreate
    );

Parameters

sesid

The database session context to use for the API call.

tableid

The table on which the index will be created.

pindexcreate

An array of JET_INDEXCREATE2 structures, each of which defines an index to be created.

cIndexCreate

The number of elements in the pindexcreate array.

Return Value

This function returns the JET_ERR data type with one of the following return codes. For more information about the possible ESE errors, see Extensible Storage Engine Errors and Error Handling Parameters.

Return code Description
JET_errSuccess The operation completed successfully.
JET_errCannotIndex An attempt was made to index over an escrow-update or SLV column (note that SLV columns are deprecated).
JET_errColumnNotFound An attempt was made to index over a non-existent column. Attempting to conditionally index over a non-existent column can also produce this error.
JET_errDensityInvalid This error will be returned if the ulDensity member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure is set to a number less than 20 or greater than 100.
JET_errIndexDuplicate An attempt to define two identical indexes was made.
JET_errIndexHasPrimary An attempt was made to specify more than one primary index for a table. A table must have exactly one primary index. If no primary index is specified, the database engine will transparently create one.
JET_errIndexInvalidDef An invalid index definition was specified. The following are some possible reasons for receiving this error:<ul><li>A primary index is conditional (grbit member of <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> has JET_bitIndexPrimary set, and the cConditionalColumn member of <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> is greater than zero).</li><li>Windows Server 2003 and later versions of Windows. Attempting to create a tuple index with tuple limits, but without passing information in the ptuplelimits member in <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> (that is, grbit has JET_bitIndexTupleLimits set, but the ptuplelimits pointer is NULL).</li><li>Passing in an invalid key definition in the szKey member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure. See <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> for a discussion of valid definitions.</li><li>Setting the cbVarSegMac member in <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> to be greater than JET_cbPrimaryKeyMost (for a primary index) or greater than JET_cbSecondaryKeyMost (for a secondary index).</li><li>Passing an invalid combination for a user-defined Unicode index (one which has the JET_bitIndexUnicode bit set in the grbit member of <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a>). Some common causes may be that the pidxunicode field of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure is NULL, or the LCID specified in the pidxunicode structure is invalid.</li><li>Specifying a multi-valued column for a primary index.</li><li>Trying to index too many conditional columns. The cConditionalColumn member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure must not be greater than JET_ccolKeyMost.</li></ul>
JET_errIndexTuplesInvalidLimits Windows XP and later versions of Windows. A <a href="gg269207(v=exchg.10).md">JET_TUPLELIMITS</a> structure was specified, and its limits are not supported. See the remarks section of the <a href="gg269207(v=exchg.10).md">JET_TUPLELIMITS</a> structure.
JET_errIndexTuplesNonUniqueOnly Windows XP and later versions of Windows. A tuple index cannot be unique (grbit must not have both JET_bitIndexTuples and JET_bitIndexUnique set).
JET_errIndexTuplesOneColumnOnly Windows XP and later versions of Windows. A tuple index can only be over a single column (that is, the grbit member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure has JET_bitIndexTuples set, and the szKey member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure specifies more than one column).
JET_errIndexTuplesSecondaryIndexOnly Windows XP and later versions of Windows. A tuple index cannot be a primary index (that is, the grbit member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure must not have both JET_bitIndexPrimary and JET_bitIndexTuples set).
JET_errIndexTuplesTextColumnsOnly Windows XP and later versions of Windows. A tuple index can only be on a text or Unicode column. An attempt to index other columns (for example, binary columns) will result in JET_errIndexTuplesTextColumnsOnly.
JET_errIndexTuplesVarSegMacNotAllowed Windows XP and later versions of Windows. A tuple index does not allow the cbVarSegMac member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure to be set.
JET_errInTransaction An attempt was made to create an index without version information while in a transaction.
JET_errInvalidgrbit The index definition is invalid because the grbit member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure contains inconsistent values. The following are some possible reasons:<ul><li>A primary index had an ignore bit specified (JET_bitIndexPrimary was passed with one of JET_bitIndexIgnoreNull, JET_bitIndexIgnoreAnyNull, or JET_bitIndexIgnoreFirstNull).</li><li>An empty index does not ignore any NULL fields (that is, grbit member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure has JET_bitIndexEmpty set, but does not have JET_bitIndexIgnoreAnyNull set).</li><li>Passing in a <a href="gg269214(v=exchg.10).md">JET_CONDITIONALCOLUMN</a> structure with an invalid grbit member. See <a href="gg269214(v=exchg.10).md">JET_CONDITIONALCOLUMN</a>.</li></ul>When creating several indexes at once (that is, if the cIndexCreate parameter is greater than one), none of the indexes may contain any of the following bits:<ul><li>JET_bitIndexPrimary</li><li>JET_bitIndexUnversioned</li><li>JET_bitIndexEmpty</li></ul>
JET_errInvalidLanguageId An invalid Locale ID (LCID) was passed in (either through the lcid member in the <a href="gg294097(v=exchg.10).md">JET_UNICODEINDEX</a> structure, which the pidxunicode member in the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure contains a pointer to, or through the lcid member of the <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure).
JET_errInvalidName An invalid index name was specified. See <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> for more details.
JET_errInvalidParameter An invalid parameter was passed into the API. The following are some reasons why this error may be returned:<ul><li>The cbKey field of a <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure is set to zero.</li><li>The cbStruct member of a <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> structure is not set to sizeof( <a href="gg294082(v=exchg.10).md">JET_INDEXCREATE2</a> ).</li></ul>
JET_errUnicodeTranslationFail An error occurred while trying to normalize a Unicode column. This can be caused by running out of system resources.
JET_errSpaceHintsInvalid An element of the JET space hints structure was not correct or actionable.
Remarks

The return value is JET_errSuccess on successful completion of all indexes specified.

JetCreateIndex3 iterates through the indexes given in pindexcreate, and will sometimes abort on the first failure. Any indexes after the first index with an error may not have been attempted, even though the err member of the JET_INDEXCREATE2 structure contains JET_errSuccess.

Requirements
Requirement Value
Client Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Server Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Header Declared in Esent.h.
Library Use ESENT.lib.
DLL Requires ESENT.dll.
Unicode Implemented as JetCreateIndex3W (Unicode) and JetCreateIndex3A (ANSI).
See Also

JET_CONDITIONALCOLUMN
JET_ERR
JET_GRBIT
JET_SESID
JET_TABLEID
JET_INDEXCREATE2
JetCreateIndex
JetCreateTableColumnIndex
JetCreateTableColumnIndex2
JET_SPACEHINTS

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 04/11/2016
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。