title: How to call first SQL Server stored procedure to second stored procedure
body: <p>I have three tables:</p>
  
  <ul>
  <li>TB1 : P (p_id (pk),p_name,p_description)</li>
  <li>TB2: PV (pv_id (pk),p_id(fk),v_id(fk),cost)</li>
  <li>TB3: V (V_id (pk),name)</li>
  </ul>
  
  <p>I have used below SQL Server stored procedure "Addp" which inserts <code>p_name</code> and <code>p_description</code> on being called.</p>
  
  <pre><code>CREATE PROCEDURE AddP 
      (@name CHAR(50), 
       @description VARCHAR(255)) 
  AS
  BEGIN
      DECLARE @PCount INT
  
      SELECT @PCount = Count(P_ID) 
      FROM P
      WHERE P_Name= @name
  
      IF @PCount = 0
      BEGIN
          INSERT INTO P(P_Name, P_Description)
          VALUES(@name, @description)
      END
  
      RETURN @@IDENTITY
  END
  </code></pre>
  
  <p>Now, I would like to create another procedure where I can insert "v_id" and cost along with "Addp" stored procedure.My second SP looks like following. My question is How should I call my first stored procedure into second new stored procedure. So that when I execute my second stored procedure I should be able to insert p_name,p_description,vi,cost everything in one shot?</p>
  
  <pre><code>CREATE PROCEDURE AddPWithV (@vi int, @cost decimal(12,4))
  AS
  BEGIN
  
          INSERT INTO PV (V_ID, Cost)
          VALUES(@vi, @cost)
      Return @@IDENTITY
  END;
  </code></pre>
  
  <p>I am new to stored procedure.So,please guide me through explanation.
  Any help is appreciated!
  Thanks in advance!</p>