Export (0) Print
Expand All

EXECUTE IMMEDIATE

SQL Server 2000

  New Information - SQL Server 2000 SP3.

The EXECUTE IMMEDIATE statement runs the embedded SQL statement contained in the specified host variable.

Syntax

EXECUTE IMMEDIATE :stmt_hvar

Arguments

stmt_hvar

Is a character string host variable that contains a Transact-SQL statement.

Remarks

The EXECUTE IMMEDIATE statement must conform to Transact-SQL statement rules. It cannot contain input parameter markers or host variables. It cannot return results. Results returned from this statement are discarded. Additionally, the statement cannot contain keywords that pertain exclusively to ESQL/C.

If any rows are returned, SQLCODE is set to +1, which indicates an exception.

Examples
strncpy(prep, "DELETE FROM mf_table WHERE name='elaine'", 41);

EXEC SQL EXECUTE IMMEDIATE :prep;

See Also

EXECUTE

Show:
© 2014 Microsoft