Batches of Statements
SQL Server Native Client (SNAC) is not supported beyond SQL Server 2012. Avoid using SNAC in new development work, and plan to modify applications that currently use it. The Microsoft ODBC Driver for SQL Server provides native connectivity from Windows to Microsoft SQL Server and Microsoft Azure SQL Database.
A batch of Transact-SQL statements contains two or more statements, separated by a semicolon (;), built into a single string passed to SQLExecDirect or SQLPrepare Function. For example:
SQLExecDirect(hstmt, "SELECT * FROM Authors; SELECT * FROM Titles", SQL_NTS);
Batches can be more efficient than submitting statements separately because network traffic is often reduced. Use SQLMoreResults to get positioned on the next result set when finished with the current result set.
Batches can always be used when the ODBC cursor attributes are set to the defaults of a forward-only, read-only cursor with a rowset size of 1.
If a batch is executed when using server cursors against SQL Server, the server cursor is implicitly converted to a default result set. SQLExecDirect or SQLExecute return SQL_SUCCESS_WITH_INFO, and a call to SQLGetDiagRec returns:
szSqlState = "01S02", pfNativeError = 0 szErrorMsg = "[Microsoft][SQL Server Native Server Native Client]Cursor type changed."