Using Input Parameters

To increase the flexibility of stored procedures and perform more complex processing, you can pass parameters to stored procedures. The parameters can be used anywhere that local variables can be used within the procedure code.

The following example is a stored procedure that requires three parameters:

CREATE PROC paramproc @parm1 int, @parm2 int, @parm3 intAS-- Processing goes hereRETURN

If you want to help identify the data values for which the parameters are defined, it is recommended that you give your parameters meaningful names. Parameter names, like local variables, can be up to 128 characters in length, including the @ sign, and they must follow SQL Server rules for identifiers. Up ...

Get Microsoft SQL Server 2014 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.