title: How to execute stored procedure in another stored procedure in sql server
body: <p>I am working on sql server 2008.</p>
  
  <p>And i have a stored procedure in which i am executing one more usp.</p>
  
  <p>Here i want to get the output of second usp and return the main usp output parameter accordingly.</p>
  
  <p>But my main usp always returning the second usp value with the main usp value.</p>
  
  <p>But i want to return only main usp value.</p>
  
  <p>Below is my procedure :</p>
  
  <pre><code>ALTER Proc [dbo].[usp_ChangeStatus](@id int,@Status int,@Name varchar(300),@Success int output  )
  as
  set @Success=0
  begin try   
  
  if exists(Select * from tbl_abc where id= @id)
  Begin               
  
      if(@Status =1)
      begin
          ----Try-Catch block----
          begin try               
              declare @AddHostStatus as int
              set @AddHostStatus=0                
                              exec @AddHostStatus =usp_xyz @Name,0,@Address       
              if(@AddHostStatus=-3)               
              begin
              set @Success=1
              end             
          end try
          begin catch
              set @Success=0
          end catch
          ----End-Try-Catch block----     
      end     
      if(@Success=1)
      begin               
      --do something here         
      end                 
   End 
          end try 
          begin catch 
      set @Success=0  
       end catch
          select  @Success
  </code></pre>