Executing Stored Procedures
To execute a stored procedure, you simply invoke it by using its name (the same way you probably have already executed system stored procedures, such as sp_help
). If the execution of the stored procedure isn’t the first statement in a batch, you need to precede the procedure name with the EXEC
keyword. Following is the basic syntax for executing stored procedures:
[EXEC[UTE]] [@status =] [schema].procedure_name[; number] [[@param_name =] expression [output][, ... ]][WITH RECOMPILE | { RESULT SETS UNDEFINED } | { RESULT SETS NONE } | { RESULT SETS ( <result_sets_definition> [,...n ] ) }]
Note
The reason you need the EXEC
keyword when invoking a stored procedure in a batch or ...
Get Microsoft® SQL Server 2012 Unleashed 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.