title: Umbraco + Petapoco - Stored procedure to temp table
body: <p>Evening,</p>
  
  <p>I'm trying to exec a stored procedure into a temporary table so I can join some bits from another table. </p>
  
  <p>Obviously the ideal solution would be to add the join into the stored procedure however this is currently not an option. </p>
  
  <p>Here's what I'm trying to run in my controller action:</p>
  
  <pre><code>db.Query&lt;HomeLatestTradesViewModel&gt;(Sql.Builder
  .Append("INSERT INTO #tmp_trade")
  .Append("EXEC get_trade_data_latest")
   );
  </code></pre>
  
  <p>Which hits me with:</p>
  
  <blockquote>
    <p>Invalid object name 'HomeLatestTradesViewModel'.</p>
  </blockquote>
  
  <p>I believe this is because I need a <code>;</code> before the <code>EXEC</code> however that just throws an error telling me it shouldn't be there!</p>
  
  <p>Any help getting this to work is appreciated.</p>