---
title: "SQL call a SP from another SP"  
description: "SQL call a SP from another SP"  
author: "Anonymous User"  
published: 2013-07-20  
updated: 2013-07-20  
canonical: https://www.mindstick.com/forum/1344/sql-call-a-sp-from-another-sp  
category: "mssql server"  
tags: ["mssql server"]  
reading_time: 1 minute  

---

# SQL call a SP from another SP

HI [developers](https://www.mindstick.com/articles/12875/blunders-you-must-avoid-while-hiring-java-developers-to-get-the-best-fulfilling-your-needs)!

Can I please have some help with the syntax of a SP in SQL.

Here is my [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii):

```
CREATE PROCEDURE usp_GetValue(    @ID VARCHAR(10),    @Description VARCHAR(10))ASBEGIN    return @ID + @DescriptionENDCREATE PROCEDURE usp_InsertValue(    @ID VARCHAR(10),    @FirstName VARCHAR(50),    @LastName VARCHAR(50),    @Description VARCHAR(10),    @Comment VARCHAR(max))ASBEGIN    Declare @v_Value VARCHAR(15)    Set @v_Value = usp_GetValue(@ID, @Description)END
```

In the usp_InsertValue SP, I am wanting to declare and set a [variable](https://www.mindstick.com/articles/1807/objective-c-data-types-variables-object-creation). Once the variable has been declared, I then wish to call another SP with [parameters](https://www.mindstick.com/articles/87/passing-parameters-in-c-sharp) to set the [value](https://www.mindstick.com/articles/23219/an-optimized-description-adds-value-to-experience-and-in-turn-effectively-guest-posting-packages) of the declared variable.

I am not sure of the syntax. May I please have some help?

## Replies

### Reply by shreesh chandra shukla

Hell Mr. hugh!you shuld to try this

I think output parameters should be the proper way: See this post: stored procedure returns varchar

```
CREATE PROCEDURE usp_GetValue(    @ID VARCHAR(10),    @Description VARCHAR(10),    @res  VARCHAR(10) OUTPUT)ASBEGIN    return @ID + @DescriptionENDCREATE PROCEDURE usp_InsertValue(    @ID VARCHAR(10),    @FirstName VARCHAR(50),    @LastName VARCHAR(50),    @Description VARCHAR(10),    @Comment VARCHAR(max))ASBEGIN    Declare @v_Value VARCHAR(15)    EXEC usp_GetValue @ID, @Description, @v_Value    -- use @v_Value here...END
```


---

Original Source: https://www.mindstick.com/forum/1344/sql-call-a-sp-from-another-sp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
