JetCreateIndex Function


Last modified: March 09, 2015

Applies to: Windows | Windows Server

The JetCreateIndex function enables you to create an index of data in an Extensible Storage Engine (ESE) database, which you can use to locate specific data quickly.

JET_ERR JET_API JetCreateIndex(
  __in          JET_SESID sesid,
  __in          JET_TABLEID tableid,
  __in          JET_PCSTR szIndexName,
  __in          JET_GRBIT grbit,
  __in          const tchar* szKey,
  __in          unsigned long cbKey,
  __in          unsigned long lDensity



The database session context to use for a particular API call.


The table that an index will be created for.


A pointer to a null-terminated string that specifies the name of the index to be created.

The index name must conform to the following guidelines:

  • It must contain fewer characters than JET_cbNameMost, not including the terminating null character.

  • It must contain only characters from the following categories: 0 through 9, A through Z, a through z, and all punctuation characters except for "!" (exclamation point), "," (comma), "[" (opening bracket), and "]" (closing bracket) — that is, the ASCII characters 0x20, 0x22 through 0x2d, 0x2f through 0x5a, 0x5c, and 0x5d through 0x7f.

  • It must not begin with a space.

  • It must contain at least one non-space character.


A group of bits that contains the options to be used for a particular call. This parameter can include zero or more of the options found in the JET_INDEXCREATE structure.


A pointer to a double null-terminated string of null-delimited tokens.

For more information about this parameter, see the JET_INDEXCREATE structure.


The length, in bytes, of the szKey parameter, including the two terminating null characters.


The percentage density of the initial index B+ tree.

For more information about this parameter, see the JET_INDEXCREATE structure.

Return Value

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

Return code



The operation completed successfully.

For a list of additional errors that can be returned by the JetCreateIndex function, see JetCreateIndex2.


Calling the JetCreateIndex function is identical to calling the JetCreateIndex2 function with a JET_INDEXCREATE structure containing the same settings as the parameters of JetCreateIndex, and a cIndexCreate parameter equal to 1. For the fields of the JET_INDEXCREATE structure that do not have corresponding parameters in JetCreateIndex, a value of 0 is assumed.

Note that JetCreateIndex has been superseded by JetCreateIndex2.



Requires Windows Vista, Windows XP, or Windows 2000 Professional.


Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.


Is declared in Esent.h.


Uses ESENT.lib.


Requires ESENT.dll.


Is implemented as JetCreateIndexW (Unicode) and JetCreateIndexA (ANSI).

See Also