First, we have need to create a Stored Procedure which accept two values as parameter. So define two parameters as @FirstName and @ LastName in stored Procedure which accept the values.
CREATE PROCEDURE usp_TestDemo(
@FirstName VARCHAR(50),
@LastName VARCHAR(50)
)AS
BEGIN
SELECT @FirstName AS FirstName,
@LastName AS LastName;
END
Now, Execute the Stored Procedure, there are two different way to pass the values to parameters in stored procedure.
1- EXEC usp_TestDemo 'Steive', 'Markas'
GO
EXEC usp_TestDemo 'Markas', 'Steive'
GO
If you observe in above statement values are provide in stored procedure without providing the name of parameters. In this case values are assign to the parameters by order.
2- EXEC usp_TestDemo
@FirstName='Steive',
@LastName= 'Markas'
GO
EXEC usp_TestDemo
@LastName='Markas',
@FirstName= 'Steive'
GO
In this case order is not matter because values are providing with the parameter name when execute the stored procedure.
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Pass values to the parameter in Stored Procedure :
First, we have need to create a Stored Procedure which accept two values as parameter. So define two parameters as @FirstName and @ LastName in stored Procedure which accept the values.
Now, Execute the Stored Procedure, there are two different way to pass the values to parameters in stored procedure.
If you observe in above statement values are provide in stored procedure without providing the name of parameters. In this case values are assign to the parameters by order.
In this case order is not matter because values are providing with the parameter name when execute the stored procedure.