title: How to call stored procedure inside stored procedure?
body: <p>I am defining one user defined table type in SQL Server 2008.</p>
  
  <p>This is the code</p>
  
  <pre><code>CREATE TYPE [dbo].[PayElementTable] AS TABLE(
      [EffDate] [varchar](30) NULL,
      [PayEle] [varchar](50) NULL,
      [ComType] [varchar](50) NULL,
      [Oper] [varchar](20) NULL,
      [Amount] [decimal](10, 2) NULL,
      [Rowno] [varchar](10) NULL
  )
  GO
  </code></pre>
  
  <p>Then I create a procedure <code>sptemptable</code></p>
  
  <pre><code>CREATE PROCEDURE sptemptable
          @T PayElementTable Readonly,--user type as parameter
      @CTCID int
      AS
  BEGIN
      -- SET NOCOUNT ON added to prevent extra result sets from
      -- interfering with SELECT statements.
      SET NOCOUNT ON; 
  
  END
  GO
  </code></pre>
  
  <p>What I want to do is I want to pass datatable as <code>@T</code> from C# and loop through the <code>@T</code> records inside above stored procedure and with in that loop I want to call another stored procedure with parameter and how to pass parameter to that procedure.</p>
  
  <p>How can I do this? </p>