O'Reilly logo

Microsoft® SQL Server™ 2000 Programming by Example by Carlos Eduardo Rojas, Fernando G. Guerrero

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required