title: Return a table variable from CLR stored procedure call
body: <p>I have an existing CLR that uses XST to shred and validate XML passed in.  I want to capture the data points (don't care about the XML itself) into a table that can be directly inserted into a database table.  So I'd call my CLR stored proc and it would return 4 columns with hundreds or rows and I could simply do an </p>
  
  <pre><code>insert into EXISTINGtable 
  select * from TableReturnedFromCLRspCAll
  </code></pre>
  
  <p>It doesn't have to be an SP it could be a UDF ... my real question is how do I get CLR to return a table.  I need to be able to pass in the table definition as well.  So for the table that is being returned by the CLR ... I would like to have the 4 column names and types be part of the call to the CLR as variables.</p>
  
  <p>If someone can help me with this I would be most grateful and very impressed because I've asked around to some very seasoned guys and they all throw up their hands when I get to the CLR having a dynamic table AND/OR CLR returning a table at all.</p>
  
  <p>Thanks!</p>