ODBC commands

This table lists the ODBC commands:

Command Options Description
odbc sqlallochandle
  • HandleType
  • InputHandle
  • OutputHandlePtr
Allocates memory for one of the four types of OBDC handles: environment, connection, statement, or descriptor.
odbc sqlbindcol
  • hstmt
  • icol
  • fCType
  • rgbValue
  • cbValueMax
  • pcbValue
Assigns the storage and data type for a column in a result set.
odbc sqlbindparameter
  • hstmt
  • ipar
  • fParamType
  • fCType
  • fSqlType
  • cbColDef
  • ibScale
  • rgbValue
  • cbValueMax
  • pcbValue
Binds a buffer to a parameter marker in an SQL statement.
odbc sqlbrowseconnect
  • hdbc
  • szConnStrIn
  • cbConnStrIn
  • szConnStrOut
  • cbConnStrOutMax
  • pcbConnStrOut
Supports an iterative method of discovering and enumerating the attributes and attribute values required to connect to a data source.
odbc sqlbulkoperations
  • StatementHandle
  • Operation
Performs bulk insertions and bulk bookmark operations: update, delete, retrieve by bookmark.
odbc sqlcancel hstmt Cancels the processing on a statement.
odbc sqlclosecursor StatementHandle Closes a cursor that has been opened on a statement and discards pending results.
odbc sqlcolattribute
  • StatementHandle
  • ColumnNumber
  • FieldIdentifier
  • CharacterAttributePtr
  • BufferLength
  • StringLengthPtr
  • NumericAttributePtr
Returns descriptor information for a column in a result set.
odbc sqlcolumnprivileges
  • hstmt
  • szTableQualifier
  • cbTableQualifier
  • szTableOwner
  • cbTableOwner
  • szTableName
  • cbTableName
  • szColumnName
  • cbColumnName
Supplies a list of columns and associated privileges for the specified table.
odbc sqlcolumns
  • hstmt
  • szTableQualifier
  • cbTableQualifier
  • szTableOwner
  • cbTableOwner
  • szTableName
  • cbTableName
  • szColumnName
  • cbColumnName
Supplies a list of column names in specified tables.
odbc sqlconnect
  • hdbc
  • szDSN
  • cbDSN
  • szUID
  • cbUID
  • szAuthStr
  • cbAuthStr [-encoding encName]
Loads a driver and establishes a connection to a data source.
odbc sqlcopydesc
  • SourceDescHandle
  • TargetDescHandle
Copies descriptor information from one descriptor handle to another.
odbc sqldatasources
  • henv
  • fDirection
  • szDSN
  • cbDSNMax
  • pcbDSN
  • szDescription
  • cbDescriptionMax
  • pcbDescription
Lists data source names.
odbc sqldescribecol
  • hstmt
  • icol
  • szColName
  • cbColNameMax
  • pcbColName
  • pfSqlType
  • pcbColDef
  • pibScale
  • pfNullable
Supplies a description of one column in the result set.
odbc sqldescribeparam
  • hstmt
  • ipar
  • pfSqlType
  • pcbColDef
  • pibScale
  • pfNullable
Supplies the description of a parameter marker that is associated with a prepared SQL statement.
odbc sqldisconnect hdbc Closes the connection that is associated with a specific connection handle.
odbc sqldriverconnect
  • hdbc
  • hwnd
  • szConnStrIn
  • cbConnStrIn
  • szConnStrOut
  • cbConnStrOutMax
  • pcbConnStrOut
  • fDriverCompletion
An alternative to SQLConnect for connecting to a data source. Use if more connection information than the three arguments in SQLConnect are required.
odbc sqldrivers
  • henv
  • fDirection
  • szDriverDesc
  • cbDriverDescMax
  • pcbDriverDesc
  • szDriverAttributes
  • cbDrvrAttrMax
  • pcbDrvrAttr
Lists driver descriptions and driver attribute keywords.
odbc sqlendtran
  • HandleType
  • Handle
  • CompletionType
Requests a commit or rollback operation for active operations on statements that are associated with a connection or all connections associated with an environment.
odbc sqlexecdirect
  • hstmt
  • szSqlStr
  • cbSqlStr
Runs a preparable statement using the current values of the parameter marker variables, if any parameters exist in the statement. This is the fastest way to submit an SQL statement for running one instance.
odbc sqlexecute hstmt Runs a prepared statement, using the current values of the parameter marker variables, if any parameter markers exist in the statement.
odbc sqlfetch hstmt Retrieves a row of data from a result set. The driver provides data for all columns that were bound to storage locations with SQLBindCol.
odbc sqlfetchscroll
  • StatementHandle
  • FetchOrientation
  • FetchOffset
Retrieves the specified rowset of data from the result set and returns data for all bound columns.
odbc sqlforeignkeys
  • hstmt
  • szPkTableQualifier
  • cbPkTableQualifier
  • szPkTableOwner
  • cbPkTableOwner
  • szPkTableName
  • cbPkTableName
  • szFkTableQualifier
  • cbFkTableQualifier
  • szPkTableOwner
  • cbPkTableOwner
  • szPkTableName
  • cbPkTableName
This supplies:
  • A list of foreign keys in the specified table.
  • A list of foreign keys in other tables that refer to the primary key in the specified table.
odbc sqlfreehandle
  • HandleType
  • Handle
Frees resources that are associated with a specific environment, connection, statement, or descriptor handle.
odbc sqlfreestmt
  • hstmt
  • free_option, where free_option is SQL_UNBIND, SQL_RESET_PARAMS, or SQL_DROP
Stops processing that is associated with a specific statement. It also closes any open cursors associated with hstmt, discards pending results, and, optionally, frees all resources associated with the statement handle.
odbc sqlgetconnectattr
  • ConnectionHandle
  • Attribute
  • ValuePtr
  • BufferLength
  • StringLengthPtr
Returns the current setting of a connection attribute.
odbc sqlgetcursorname
  • hstmt
  • szCursor
  • cbCursorMax
  • pcbCursor
Supplies the cursor name that is associated with a specific statement.
odbc sqlgetdata
  • hstmt
  • icol
  • fCType
  • rgbValue
  • cbValueMax
  • pcbValue
Provides result data for a single unbound column in the current row.
odbc sqlgetdescfield
  • DescriptorHandle
  • RecNumber
  • FieldIdentifier
  • ValuePtr
  • BufferLength
  • StringLengthPtr
Returns the current setting or value of a single field of a descriptor record.
odbc sqlgetdescrec
  • DescriptorHandle
  • RecNumber
  • Name
  • BufferLength
  • StringLengthPtr
  • TypePtr
  • SubTypePtr
  • LengthPtr
  • PrecisionPtr
  • ScalePtr
  • NullablePtr
Returns the current setting or values of multiple fields of a descriptor record.
odbc sqlgetdiagfield
  • HandleType
  • Handle
  • RecNumber
  • DiagIdentifier
  • DiagInfoPtr
  • BufferLength
  • StringLengthPtr
Returns the current value of a field of the diagnostic data structure that is associated with a specific handle containing error, warning, and status information.
odbc sqlgetdiagrec
  • HandleType
  • Handle
  • RecNumber
  • Sqlstate
  • NativeErrorPtr
  • MessageText
  • BufferLength
  • TextLengthPtr
Returns the current values of multiple fields of a diagnostic record that contains error, warning, and status information.
odbc sqlgetenvattr
  • EnvironmentHandle
  • Attribute
  • ValuePtr
  • BufferLength
  • StringLengthPtr
Returns the current setting of an environment attribute.
odbc sqlgetfunctions
  • hdbc
  • fFunction
  • pfExists
Supplies information about whether a driver supports a specific ODBC function.
odbc sqlgetinfo
  • hdbc
  • fInfoType
  • rgbInfoValue cbInfoValueMax
  • pcbInfoValue
Supplies general information about the driver and data source that are associated with a connection.
odbc sqlgetstmtattr
  • StatementHandle
  • Attribute
  • ValuePtr
  • BufferLength
  • StringLengthPtr
Returns the current setting of a statement attribute.
odbc sqlgettypeinfo
  • hstmt
  • fSqlType
Supplies information about data types supported by the data source.
odbc sqlmoreresults hstmt Determines whether there are more results available on an hstmt containing SELECT, UPDATE, INSERT, or DELETE statements. If so, then it initializes processing for those results.
odbc sqlnativesq
  • hdbc
  • szSqlStrIn
  • cbSqlStrIn
  • szSqlStr
  • cbSqlStrMax
  • pcbSqlStr
Supplies the SQL string as translated by the driver.
odbc sqlnumparams
  • hstmt
  • pcpar
Supplies the number of parameters in an SQL statement.
odbc sqlnumresultcols
  • hstmt
  • pccol
Supplies the number of columns in a result set.
odbc sqlnumresultcols
  • hstmt
  • pccol
Supplies the number of columns in a result set.
odbc sqlparamdata
  • hstmt
  • rgbValue
Used in conjunction with SQLPutData to supply parameter data at statement running time.
odbc sqlprepare
  • hstmt
  • szSqlStr
  • cbSqlStr
Prepares an SQL string for running.
odbc sqlprimarykeys
  • hstmt
  • szTableQualifier
  • cbTableQualifier
  • szTableOwner
  • cbTableOwner
  • szTableName
  • cbTableName
Returns the column names that makes up the primary key for a table.
odbc sqlprocedurecolumns
  • hstmt
  • szProcQualifier
  • cbProcQualifier
  • szProcOwner
  • cbProcOwner
  • szProcName
  • cbProcName
  • szColumnName
  • cbColumnName
Returns the list of input and output parameters, including the columns that make up the result set for the specified procedures.
odbc sqlprocedures
  • hstmt
  • szProcQualifier
  • cbProcQualifier
  • szProcOwner
  • cbProcOwner
  • szProcName
  • cbProcName
Returns the list of procedure names that are stored in a specific data source.
odbc sqlputdata
  • hstmt
  • rgbValue
  • cbValue
Sends data for a parameter or column to the driver at statement running time.
odbc sqlrowcount
  • hstmt
  • pcrow
Returns the number of rows that are affected by an UPDATE, INSERT, or DELETE statement or by a SQL_UPDATE, SQL_ADD, or SQL_DELETE operation in SQLSetPos.
odbc sqlsetconnectattr
  • HandleType
  • InputHandle
  • OutputHandlePtr
Sets attributes that govern aspects of connections.
odbc sqlsetcursorname
  • hstmt
  • szCursor
  • cbCursor
Associates a cursor name with an active statement.
odbc sqlsetdescfield
  • DescriptorHandle
  • RecNumber
  • FieldIdentifier
  • ValuePtr
  • BufferLength
Sets the value of a single field of a descriptor record.
odbc sqlsetdescrec
  • DescriptorHandle
  • RecNumber
  • Type
  • SubType
  • Length
  • Precision
  • Scale
  • DataPtr
  • StringLengthPtr
  • IndiDataPtrcatorPtr
Sets multiple descriptor fields that affect the data type and buffer that are bound to a column or parameter.
odbc sqlsetenvattr
  • EnvironmentHandle
  • Attribute
  • ValuePtr
  • StringLength
Sets attributes that govern aspects of environments.
odbc sqlsetpos
  • hstmt
  • irow
  • fOption
  • fLock
Sets the cursor position in a rowset and refreshes, updates, deletes, or adds data to the rowset.
odbc sqlspecialcolumns
  • hstmt
  • fColType
  • szTableQualifier
  • cbTableQualifier
  • szTableOwner
  • cbTableOwner
  • szTableName
  • cbTableName
  • fScope fNullable
Retrieves this information about columns within a specified table:
  • The optimal set of columns that uniquely identifies a row in the table.
  • Columns that are automatically updated when any value in the row is updated by a transaction.
odbc sqlsetstmtattr
  • StatementHandle
  • Attribute
  • ValuePtr
  • StringLength
Sets attributes that are related to a statement.
odbc sqlstatistics
  • hstmt
  • szTableQualifier
  • cbTableQualifier
  • cbTableName
  • fUnique
  • fAccuracy
Retrieves a list of statistics about a single table and the indexes that are associated with the table.
odbc sqltableprivileges
  • hstmt
  • szTableQualifier
  • cbTableQualifier
  • szTableOwner
  • cbTableOwner
  • szTableName
  • cbTableName
Returns a list of tables and the privileges that are associated with each table.
odbc sqltables
  • hstmt
  • szTableQualifier
  • cbTableQualifier
  • szTableOwner
  • cbTableOwner
  • szTableName
  • cbTableName
  • szTableType
  • cbTableType
Returns the list of table names that are stored in a specific data source.