title: SQL Server stored procedure issue calling another stored procedure
body: <p>Here's a issue I have with a stored procedure (using SQL Server 2005), inside this stored procedure it calls another stored procedure putting the data into a temp table.</p>
  
  <pre><code>INSERT INTO #tmpTable (Column1, Column2, Column3) 
  EXEC psp_rptInsideStoredprocedure 2
  </code></pre>
  
  <p>This inside stored procedure has a mode parameter that determines which columns get passed out. In this mode (Mode2) only 3 columns get passed out, when this inside stored procedure is used for another report (Mode1) 4 columns gets passed out.  Sometimes the parent stored procedure complains about trying to insert the 4 column and sometimes not.  </p>
  
  <p>I know it's always passing in mode 2 but it's like SQL Server knows that sometimes this stored procedure has passed back 4 columns.</p>
  
  <p>Any thoughts on a solution?</p>
  
  <p>Thanks</p>
  
  <p>Don</p>