title: Is it possible to join a table valued function and another table with parameters
body: <p>Quick background for those interested,</p>
  
  <p>I have a master detail table(options date), about 20 details for each master record. Our oltp system that is saving the data was doing 21 inserts for each new piece of information we saved. This was killing the server, so I'm trying to get this working by substituting comma separated values for the details table. Everything seems to be working, except I can figure out how to get the details table back. I'm trying to use table valued functions, and it's not quite working.</p>
  
  <p>I'd like to call something like</p>
  
  <pre><code>Select Top 100 *
  FROM dbo.fn_MarketDataDetails (MarketDataMasterID) mdd
  INNER JOIN MarketDataMaster mdm on mdm.MarketDataMasterID = mdd.MarketDataMasterID
  </code></pre>
  
  <p>Clearly, that just doesn't compile.</p>
  
  <p>I can run </p>
  
  <pre><code>Select Top 100 *
  FROM dbo.fn_MarketDataDetails (15425) // Assuming 15425 is a valid MarketDataMasterID
  </code></pre>
  
  <p>And I get back a table that looks like my old details table.</p>
  
  <p>Is this even possible? Am I making any sense?</p>