Executing Stored Procedures

There are a variety of ways to execute stored procedures. All depend on the calling application, language used, and the programming interface (OLE-DB, ODBC, ADO, and so on). In Transact-SQL, the basic syntax to execute a stored procedure is the following:

EXECUTE @return_value = procedure_name parameter_1,..,parameter_n

The EXECUTE statementmust be used if there's more than one instruction in the batch. Otherwise, if you want to execute just the stored procedure and there are no more instructions in the batch, you can omit the EXECUTE statement.

Tip

If there's more than one instruction in the batch and the stored procedure is called in the first line of the batch, you can omit the EXECUTE statement.

There are two ...

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.