SQL Server Native Client Commands Generating Multiple-Rowset Results

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)

The SQL Server Native Client OLE DB provider can return multiple rowsets from SQL Server statements. SQL Server statements return multiple-rowset results under the following conditions:

  • Batched SQL statements are submitted as a single command.

  • Stored procedures implement a batch of SQL statements.

Batches

The SQL Server Native Client OLE DB provider recognizes the semicolon character as a batch delimiter for SQL statements:

WCHAR*       wSQLString = L"SELECT * FROM Categories; "  
                          L"SELECT * FROM Products";  

Sending multiple SQL statements in one batch is more efficient than executing each SQL statement separately. Sending one batch reduces the network round trips from the client to the server.

Stored Procedures

SQL Server returns a result set for each statement in a stored procedure, so most SQL Server stored procedures return multiple result sets.

In This Section

See Also

Commands