title: SQL Server : stored procedure to have optional parameter
body: <p>How do we specify default parameters for stored procedures?</p>
  
  <p>I have seen the following two options.</p>
  
  <p>Option 1:</p>
  
  <pre><code>CREATE PROCEDURE myProcedure(@dataOne INT, @dataTwo INT = DEFAULT)
  </code></pre>
  
  <p>Option 2:</p>
  
  <pre><code>CREATE PROCEDURE myProcedure(@dataOne INT, @dataTwo INT = 3)
  </code></pre>
  
  <p>I have used this stored procedure with one single parameter in some places of my C# code. Now I want to use it with one optional parameter. I want to make sure that the optional parameter will have a default value too.</p>
  
  <p>Any help please? Where have I gone wrong ?</p>
  
  <p>I used the above 2 methods. But it did not work. I did not get a default value.</p>