ExecuteWithResultsAndMessages Method

Description

Executes a Transact-SQL statement on a remote server. Returns any SQL Server messages received, including output from PRINT and DBCC statements. Returns results in a QueryResults object.

Visual Basic

QueryResults = RemoteServer.ExecuteWithResultsAndMessages (
[Command :=] strSQLStatement,
[[Messages :=] strMessages] )

C++

HRESULT pRemoteServer->ExecuteWithResultsAndMessages (
SQLOLE_LPCSTR
strSQLStatement,
LPSQLOLEQUERYRESULTS*
ppQueryResults,
SQLOLE_LPBSTR pstrMessages = 0 );

Elements


Element Type Description

QueryResults QueryResults Returned QueryResults object
strSQLStatement String SQL statement
strMessages String Returned SQL Server messages

QueryResults

The contents of the QueryResults object depend on the Transact-SQL statement.

Reference

sp_sqlexec