Commands can be in one of four states:
The following table lists each state and shows the code returned by each method in a command interface when it is called in that state. This table uses the following abbreviations:
OK= S_OK
NC= DB_E_NOCOMMAND
NP= DB_E_NOTPREPARED
OO= DB_E_OPENOBJECT
| Method | Initial | Unprepared | Prepared | Executed | 
| IColumnsInfo | ||||
| GetColumnInfo | NC | OK (ICommandPrepare is not supported) - or - NP (ICommandPrepare is supported)  | 
OK | OK (ICommandPrepare is not supported) - or - NP (ICommandPrepare is supported)  | 
| MapColumnIDs | NC | OK (ICommandPrepare is not supported) - or - NP (ICommandPrepare is supported)  | 
OK | OK (ICommandPrepare is not supported) - or - NP (ICommandPrepare is supported)  | 
| IColumnsRowset | ||||
| GetAvailableColumns | NC | OK (ICommandPrepare is not supported) - or - NP (ICommandPrepare is supported)  | 
OK | OK (ICommandPrepare is not supported) - or - NP (ICommandPrepare is supported)  | 
| GetColumnsRowset | NC | OK (ICommandPrepare is not supported) - or - NP (ICommandPrepare is supported)  | 
OK | OK (ICommandPrepare is not supported) - or - NP (ICommandPrepare is supported)  | 
| ICommand | ||||
| Cancel | OK | OK | OK | OK | 
| Execute | NC | OK | OK | OK | 
| GetDBSession | OK | OK | OK | OK | 
| ICommandPrepare | ||||
| Prepare | NC | OK | OK | OK (Execute did not create a rowset) - or - OO (Execute created a rowset, and the rowset is still open)  | 
| Unprepare | OK | OK | OK | OK (Execute did not create a rowset) - or - OO (Execute created a rowset, and the rowset is still open)  | 
| ICommandProperties | ||||
| GetProperties | OK | OK | OK | OK | 
| SetProperties | OK | OK | OK | OK (Execute did not create a rowset) - or - OO (Execute created a rowset, and the rowset is still open)  | 
| ICommandText | ||||
| GetCommandText | NC | OK | OK | OK | 
| SetCommandText | OK | OK | OK | OK (Execute did not create a rowset) - or - OO (Execute created a rowset, and the rowset is still open)  | 
| ICommandWithParameters | ||||
| GetParameterInfo | OK (SetParameterInfo has been called)  - or - NC (SetParameterInfo has not been called)  | 
OK (SetParameterInfo has been called)  - or - NP (ICommandPrepare is supported and SetParameterInfo has not been called)  | 
OK | OK | 
| MapParameterNames | OK (SetParameterInfo has been called) - or - NC (SetParameterInfo has not been called)  | 
OK (SetParameterInfo has been called)  - or - NP (ICommandPrepare is supported and SetParameterInfo has not been called)  | 
OK | OK | 
| SetParameterInfo | OK | OK | OK | OK (Execute did not create a rowset) - or - OO (Execute created a rowset, and the rowset is still open)  | 
The following figures illustrate the state transitions for a command. The first shows the command text set to an empty string, the second to a nonempty string.
Command text set to an empty string, then a nonempty string
