title: How to pass default keyword for table valued function call in ADO.NET
body: <p>So here's the deal. In our database, we wrap most of our reads (i.e. select statements) in table valued functions for purposes of security and modularity. So I've got a TVF which defines one or more optional parameters.</p>
  
  <p>I believe having a TVF with defaulted parameters mandates the use of the keyword <code>default</code> when calling the TVF like so:</p>
  
  <pre class="lang-sql prettyprint-override"><code>select * from fn_SampleTVF(123, DEFAULT, DEFAULT)
  </code></pre>
  
  <p>That's fine, everything works in the query analyzer, but when it comes time to actually make this request from ADO.NET, I'm not sure how to create a sql parameter that actually puts the word <code>default</code> into the rendered sql.</p>
  
  <p>I have something roughly like this now:</p>
  
  <pre class="lang-cs prettyprint-override"><code>String qry = "select * from fn_SampleTVF(@requiredParam, @optionalParam)";
  
  DbCommand command = this.CreateStoreCommand(qry, CommandType.Text);
  
  SqlParameter someRequiredParam = new SqlParameter("@requiredParam", SqlDbType.Int);
  someRequiredParam.Value = 123;
  command.Parameters.Add(someRequiredParam);
  
  SqlParameter optionalParam = new SqlParameter("@optionalParam", SqlDbType.Int);
  optionalParam.Value = &gt;&gt;&gt;&gt; WTF? &lt;&lt;&lt;&lt;
  command.Parameters.Add(optionalParam);
  </code></pre>
  
  <p>So, anybody got any ideas how to pass <code>default</code> to the TVF?</p>