다음을 통해 공유


ExecuteWithResultsAndMessages Method

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 말고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

The ExecuteWithResultsAndMessages method executes a Transact-SQL command batch returning batch result sets in a QueryResults object and capturing messages raised as part of command batch execution.

구문

object
.ExecuteWithResultsAndMessages(
Command 
,
Length
,
Messages
)
as
QueryResults

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • Command
    String that specifies a Transact-SQL or provider-specific command batch.
  • Length
    Long integer that indicates the statement batch length.
  • Messages
    String used to return message output.

Prototype (C/C++)

HRESULT ExecuteWithResultsAndMessages(
SQLDMO_LPCSTR Command,
LPSQLDMOQUERYRESULTS* ppResults,
SQLDMO_LPBSTR Messages,
long lLength);

[!참고] SQL Distributed Management Objects (SQL-DMO) strings are always returned as OLE BSTR objects. A C/C++ application obtains a reference to the string. The application must release the reference using SysFreeString.

Returns

A QueryResults object that contains command batch results. The method fills the string specified by the Messages argument with message returns, if any are generated by batch execution.

주의

The ExecuteWithResultsAndMessages2 method extends the functionality of the ExecuteWithResultsAndMessages method.

Visual Basic applications should call ExecuteWithResultsAndMessages2 instead of ExecuteWithResultsAndMessages. ExecuteWithResultsAndMessages2 is not available to C++ applications, which should call ExecuteWithResultsAndMessages.

For Microsoft SQL Server error severity indicates the degree of an error condition. Some errors are severe enough to terminate statement execution prematurely. Any error with a severity of 10 or higher is returned to the SQL-DMO application through normal error handling.

Minor errors, SQL Server errors with a severity of less than 10, indicate that statement execution succeeded, but that success was conditional. These are called Success-with-information errors. Some Transact-SQL statements, such as the PRINT statement, do not generate result sets, using messages for their return value.

The ExecuteWithResultsAndMessages2 method implements command batch execution for a SQL Distributed Management Objects (SQL-DMO) application, allowing the application to capture success-with-information errors or other information transmitted as messages.

[!참고] When using the ExecuteWithResultsAndMessages method with the LinkedServer object, command batch syntax is provider-specified. Some OLE DB providers may support message returns as defined for SQL Server. For more information, see the OLE DB provider documentation.

Applies To:

Database Object

RemoteServer Object

LinkedServer Object

SQLServer Object

참고 항목

참조

ExecuteWithResultsAndMessages2 Method

도움말 및 정보

SQL Server 2005 지원 받기