Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
You access a stored procedure by using an EXEC statement. If a stored procedure does not have any input parameters, the only code required is
EXEC <stored procedure>
If a stored procedure has input parameters, you can pass in the parameters either by name or by position:
--Execute by name EXEC <stored procedure> @parm1=<value>, @parm2=<value>,... --Execute by position EXEC <stored procedure> <value>, <value>,...
Passing parameters to a stored procedure by position results in code that is more compact; however, it is more prone to errors. When parameters are passed to a stored procedure by name, changes in the order of parameters within the procedure do not require changes elsewhere in your applications. Regardless of whether you are passing parameters by position or by name, you need to specify a value for each parameter that does not have a default value.