Last modified: March 09, 2015
Applies to: Windows | Windows Server
The JetRenameColumn function can be used to change the name of an existing column on a table.
Windows XP: JetRenameColumn is introduced in Windows XP.
JET_ERR JET_API JetRenameColumn( __in JET_SESID sesid, __in JET_TABLEID tableid, __in JET_PCSTR szName, __in JET_PCSTR szNameNew, __in JET_GRBIT grbit );
The session to use for this call.
The cursor to use for this call.
The current name of the column that will be renamed.
The new name for the column that will be renamed.
This parameter must be 0.
This function returns the JET_ERR datatype with one of the following return codes. For more information about the possible ESE errors, see Extensible Storage Engine Errors and Error Handling Parameters.
The operation completed successfully.
It is not possible to complete the operation because all activity on the instance associated with the session has ceased as a result of a call to JetStopService.
This specified column does not exist for this table.
One of the specified object names was invalid. All object names must conform to the same set of rules. These rules are as follows:
One of the parameters provided contained an unexpected value or contained a value that did not make sense when combined with the value of another parameter. This can happen for JetRenameColumn when:
It is not possible to complete the operation because the instance associated with the session has encountered a fatal error that requires that access to all data be revoked to protect the integrity of that data. This error will only be returned by Windows XP and later releases.
This operation may only be performed when the session is not currently inside a transaction.
It is not possible to complete the operation because the instance associated with the session has not been initialized yet.
It is not possible to complete the operation because a restore operation is in progress on the instance associated with the session.
The same session cannot be used for more than one thread at the same time. This error will only be returned by Windows XP and later releases.
It is not possible to complete the operation because the instance associated with the session is being shut down.
An update cannot be done while inside the scope of a read-only transaction. A read-only transaction is a transaction that has been started using a call to JetBeginTransaction2 with JET_bitTransactionReadOnly. This error will only be returned by Windows XP and later releases.
On success, the name of the specified column in the table associated with the cursor is permanently changed to the new name. Any indexes that reference that column will also be updated.
On failure, no change to the database state will occur.
The column rename operation is unusual because, unlike other schema operations, it is not carried out as a transaction. When a column in a given table is renamed in one session then any other session using that table will see the change immediately, even if they are in a transaction that would prevent that session from seeing any other change made by the session doing the rename operation.
The column ID of a column is not affected by the rename operation.
Requires Windows Vista or Windows XP.
Requires Windows Server 2008 or Windows Server 2003.
Declared in Esent.h.
Implemented as JetRenameColumnW (Unicode) and JetRenameColumnA (ANSI).