title: Using a User defined table type with a temporary stored procedure in SQL Server
body: <p>I am having trouble using a user defined table type as a parameter type to a temporary stored procedure. </p>
  
  <p>I am doing all of this within the database that houses our temp tables, temp stored procedures,... temp anything. </p>
  
  <p>The code looks like this: </p>
  
  <pre><code>CREATE TYPE test_type AS TABLE (user int, user_value int) 
  GO
  
  CREATE PROCEDURE #test_pro 
      @input test_type READONLY
  AS
      SELECT TOP 10 * 
      FROM @input 
  GO
  </code></pre>
  
  <p>I get the error: </p>
  
  <blockquote>
    <p>Parameter or variable @input has an invalid data type.</p>
  </blockquote>
  
  <p>Is there a way for me to use the data type <code>test_type</code> as a type in my temporary stored procedure? I unfortunately only have access to temporary stored procedures and not the permanent version.</p>
  
  <p>Side question: would using a function work any better?</p>