다음을 통해 공유


ExecuteImmediate Method (Database, SQLServer)

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

The ExecuteImmediate method submits a Transact-SQL command batch on a connection, and directs execution or batch interpretation as specified by the application.

구문

object
.ExecuteImmediate(
Command 
, [ ExecutionType ] 
, [ Length ] )

Parts

  • object
    Expression that evaluates to an object in the Applies To list.
  • Command
    String that specifies a Transact-SQL command batch.
  • ExecutionType
    Optional. Long integer that controls statement batch execution as described in Settings.
  • Length
    Optional. Long integer that indicates the statement batch length.

Prototype (C/C++)

HRESULT ExecuteImmediate(
SQLDMO_LPCSTR Command,
SQLDMO_EXEC_TYPE ExecType = SQLDMOExec_Default,
long lLength CPPDEFAULT(= 0));

Settings

Set the ExecutionType argument using these values.

Constant Value Description

SQLDMOExec_ContinueOnError

2

Batch execution continues on any error that does not break the connection.

SQLDMOExec_Default

0

No statement execution options set.

SQLDMOExec_/NoCommandTerm

1

Ignore the command terminator in the script. Execute as a single batch.

SQLDMOExec_NoExec

4

Execute SET NOEXEC ON prior to batch execution. Execute SET NOEXEC OFF after batch execution.

SQLDMOExec_ParseOnly

8

Execute SET PARSEONLY ON prior to batch execution. Execute SET PARSEONLY OFF after batch execution.

SQLDMOExec_QI_ON

16

Execute SET QUOTED_IDENTIFIER ON prior to batch execution. Execute SET QUOTED_IDENTIFIER OFF after batch execution.

Applies To:

Database Object

SQLServer Object