---
title: "How to pass value to the parameter in Stored Procedure?"  
description: "How to pass value to the parameter in Stored Procedure?"  
author: "Steilla Mitchel"  
published: 2021-11-07  
updated: 2021-11-07  
canonical: https://www.mindstick.com/forum/156804/how-to-pass-value-to-the-parameter-in-stored-procedure  
category: "mssql server"  
tags: ["sql server", "sql"]  
reading_time: 2 minutes  

---

# How to pass value to the parameter in Stored Procedure?

How to pass [Values](https://www.mindstick.com/forum/327/sum-textbox-values) to the [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp) in [Stored](https://www.mindstick.com/forum/157561/what-is-the-stored-procedure-create-a-procedure-to-find-the-record-by-stu_id-from-the-student-table) [Procedure in SQL](https://www.mindstick.com/forum/158350/what-is-a-stored-procedure-in-sql-server-and-how-to-create-one) [Server](https://www.mindstick.com/articles/43769/what-is-serverless-architecture-is-it-worth-switching-over)?

## Replies

### Reply by Ashutosh Kumar Verma

**Pass values to the parameter in [Stored Procedure](https://www.mindstick.com/articles/803/using-stored-procedure-in-asp-dot-net) :**

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
```

![How to pass value to the parameter in Stored Procedure?](https://www.mindstick.com/mindstickforums/36ca49a3-9ab6-4474-a8c7-8601d79fbcd5/images/c1d887cd-d955-4429-8c58-e6db5a580a15.png)\

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
```

![How to pass value to the parameter in Stored Procedure?](https://www.mindstick.com/mindstickforums/36ca49a3-9ab6-4474-a8c7-8601d79fbcd5/images/52a0e206-81cf-4bfe-86aa-0de23888e06f.png)\

In this case order is not matter because values are providing with the parameter name when execute the stored procedure.

\


---

Original Source: https://www.mindstick.com/forum/156804/how-to-pass-value-to-the-parameter-in-stored-procedure

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
