Re: Problem with way to access all recordsets returned by sp_spaceused using ODBC APIs on C++



Thanx alot for your help :)!

Chris Kushnir wrote:
exec sp_spaceused returns:

Result set 1:
database_name
database_size
unallocated space

Result set 2:
reserved
data
index_size
unused

So, from your description you are trying to get database_size (col2) from
first result set, and unused (col4) from second result set.

You have to:
SQLExecDirect()

SQLBindCol( database_name, col2 )
SQLFetch() until all records read from first result set

SQLMoreResults() if returns SQL_SUCESS then you have another result set, so
...
SQLFreeStmt( SQL_UNBIND )

SQLBindCol( unused, col4 )
SQLFetch() until all records read from second result set


cmk

.



Relevant Pages