title: SQL Server - Pass image to stored procedure, invalid local var type
body: <p>I have two tables that contain document content: one for temporary staging, other for permanent storage. The content is stored as type image (cannot change this since it's current functionality).</p>
  
  <p>I need a stored procedure that does the following:</p>
  
  <ol>
  <li>Pass in a TempDocumentID that exists in temp document table.</li>
  <li>With that TempDocumentID, select image content from temp document table.</li>
  <li>Exec existing stored procedure that takes an image parameter to insert into permanent document table.</li>
  </ol>
  
  <p>My problem is two-fold:</p>
  
  <ul>
  <li>I can't declare a local variable of type 'image' to fill from the select statement of temp table. It throws error 'The text, ntext, and image data types are invalid for local variables.'</li>
  <li>I don't know of a way to exec stored proc with direct results from select statement of temp table.</li>
  </ul>
  
  <p>Here is my SQL Fiddle example: <a href="http://sqlfiddle.com/#!3/09384/5" rel="nofollow">http://sqlfiddle.com/#!3/09384/5</a></p>
  
  <p>Thanks,
  Greg</p>