title: How to pass a temp table as a parameter into a separate stored procedure
body: <p>I have a stored procedure that takes an input parameter <code>@CategoryKeys varchar</code>, and parses its contents into a temp table, <code>#CategoryKeys</code>.</p>
  
  <pre><code>        -- create the needed temp table.
          CREATE TABLE #CategoryKeys
            (
               CategoryKey SMALLINT
            );
  
          -- fill the temp table if necessary
          IF Len(rtrim(ltrim(@CategoryKeys))) &gt; 0
            BEGIN
                INSERT INTO #CategoryKeys
                            (CategoryKey)
                SELECT value
                FROM   dbo.String_To_SmallInt_Table(@CategoryKeys, ',');
            END
  </code></pre>
  
  <p>If the temp table has rows, I would like to pass the table into a separate stored procedure. How would I go about creating a parameter in the separate procedure to hold the temp table?</p>