Microsoft KB Archive/280109

= The PRINT, RAISERROR, DBCC commands and the ODBC Driver for SQL Server 2000 and SQL Server 7.0 =

Article ID: 280109

Article Last Modified on 12/21/2004

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition
 * Microsoft SQL Server 7.0 Standard Edition

-



This article was previously published under Q280109



SUMMARY
For the ODBC 3.5x compliant SQL Server driver, messages from consecutive PRINT, RAISERROR, DBCC, or similar statements, as in a batch or stored procedure, are returned in a separate result set for each statement.



MORE INFORMATION
With Microsoft SQL Server 6.x and 2.x ODBC driver, messages from consecutive PRINT, RAISERROR, DBCC, or similar statements as in a batch or stored procedure were combined into a single result set. However, for the ODBC 3.5x compliant SQL Server driver (provided with SQL Server 2000 or SQL Server 7.0), the messages from these consecutive statements are returned in separate result sets. To process the results of these commands, use the SQLMoreResults statement.

For example: SQLExecDirect(hstmnt,&quot;PRINT 'SomeMessage1'&quot;,SQL_NTS) SQLExecDirect(hstmnt,&quot;PRINT 'SomeMessage2'&quot;,SQL_NTS) The first call to SQLERROR returns: SQL_SUCCESS=0 Then, a call to SQLMoreResults returns: SQL_SUCCESS_WITH_INFO The immediate call to SQLERROR returns: SQL_SUCCESS=0
 * szSqlState = &quot;01000&quot;, *pfNativeError = 0, *szErrorMsg = &quot;[Microsoft][ODBC SQL Server Driver][SQL Server]SomeMessage1&quot;
 * szSqlState = &quot;01000&quot;, *pfNativeError = 0, *szErrorMsg = &quot;[Microsoft][ODBC SQL Server Driver][SQL Server]SomeMessage2&quot;