The information in this article applies to:
SUMMARYThis article discusses how the Microsoft SQL Server ODBC Driver returns SET STATISTICS IO and SET STATISTICS TIME data to an application. MORE INFORMATION
The Transact-SQL commands SET STATISTICS IO and SET STATISTICS TIME can be
used to obtain information about the performance of SQL statements. When
these options are turned on in an ODBC environment:
the statistics will be returned through SQLError(). The time at which the application should call SQLError(), however, is different for each option. After SET STATISTICS TIME has been turned on, SQLExecute() or SQLExecDirect() will both return SQL_SUCCESS_WITH_INFO on successful calls. The application can retrieve the time statistics by then calling SQLError() until SQLError() returns SQL_NO_DATA_FOUND. SQLError() will return the time statistics in the following format:
The call to SQLError() must be made immediately after the SQLExecute() or SQLExecDirect() function call that generates the output. After SET STATISTICS IO has been turned on, the IO statistics are returned when the end of the result set has been reached. For example, if a select is executed and the result set is retrieved using SQLFetch(), the last SQLFetch() will return SQL_NO_DATA_FOUND. If the application then loops through calls to SQLError() until SQLError() returns SQL_NO_DATA_FOUND, the IO statistics will be returned in the following format:
There will be one 3615 message for each table involved in the query. Additional query words: odbc sql6 debug
Keywords : kbprg SSrvProg |
Last Reviewed: March 24, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |