title: Using Table data type in a local variable in a sql server 2008 stored procedure
body: <p>I'm using table type in my variable <code>@temporaltable</code>  </p>
  
  <pre><code>FETCH MyCursor Into @temporaltable 
  </code></pre>
  
  <p>but when I try to get on e field I got an error... </p>
  
  <pre><code>insert into T1 (t1field1,t1field2, t1field3) 
  values(@temporaltable.field1, @temporaltable.field2, @temporaltable.field3)   
  </code></pre>
  
  <p>it doesn't recognize <code>@temporaltable</code> and I got error </p>
  
  <blockquote>
    <p>Must declare the scalar variable  @temporaltable</p>
  </blockquote>