Search⌘ K

Stored Procedures: Input Parameters

Explore how to create stored procedures with input parameters in T-SQL. Understand the syntax differences from functions, and learn to insert data dynamically into tables using parameters, enhancing your database programming skills.

We'll cover the following...

Stored procedures can have input parameters. These are similar to function parameters. We can pass in some data when executing a stored procedure.

Syntax

Declaring parameters for a stored procedure differs slightly from the function declaration syntax:

CREATE PROCEDURE Schema.ProcedureName
    @Parameter1 ParameterType,
    @Parameter2 ParameterType,
    ...
    @ParameterN ParameterType
AS
BEGIN
    [Procedure body]
END;

As we can see, there are no parentheses in the procedure declaration.

Usage

To call a stored ...