Last modified: January 09, 2012
Applies to: Windows | Windows Server
The JetSetColumnDefaultValue function can be used to change the default value of an existing column.
JET_ERR JET_API JetSetColumnDefaultValue( __in JET_SESID sesid, __in JET_DBID dbid, __in JET_PCSTR szTableName, __in JET_PCSTR szColumnName, __in const void* pvData, __in const unsigned long cbData, __in const JET_GRBIT grbit );
The session to use for this call.
The database to use for this call.
The name of the table containing the column that will be affected.
The name of the column whose default value will be changed.
The input buffer containing the new default value.
The size of the input buffer containing the new default value.
Reserved for future use.
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.
Same as JET_errNullInvalid.
This specified column is currently in use by an index.
JetSetColumnDefaultValue cannot change the default value of a column that is referenced in the definition of an index. This is because doing so could change the contents of the index.
This specified column does not exist for this table.
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.
The specified database ID was invalid.
One of the specified object names was invalid. All object names must conform to the same set of rules. These rules are as follows:
It is not possible to complete the operation because the instance associated with the session has not been initialized yet.
The column could not be set to NULL. This happens for JetSetColumnDefaultValue when:
Therefore, it is not possible to set the default value of a column (back) to NULL or to a zero length value.
This specified table does not exist for this database.
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.
This specified table is in use by another session.
JetSetColumnDefaultValue requires exclusive access to a table in order to change the default value of the column for releases prior to Windows Server 2003.
It is not possible to complete the operation because the instance associated with the session is being shut down.
It is illegal to attempt an update when 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.
Another session has previously locked the record for update. The update attempted by this session will fail.
On success, the default value of the specified column in the given table in the given database is permanently changed to the new default value.
On failure, no change to the database state will occur.
It is not possible to change the default value of a column in a template table.
The database engine will silently truncate the default value of a column to 255 bytes for long text and long binary columns.
Requires Windows Vista, Windows XP, or Windows 2000 Professional.
Requires Windows Server 2008, Windows Server 2003, or Windows 2000 Server.
Declared in Esent.h.
Implemented as JetSetColumnDefaultValueW (Unicode) and JetSetColumnDefaultValueA (ANSI).