title: SQL function as default parameter value?
body: <p>I tried changing a default parameter value with this:</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[my_sp]
  @currentDate datetime = GETDATE()
  </code></pre>
  
  <p>and all the SQL pre-compiler gave me was this error:</p>
  
  <blockquote>
    <p>Msg 102, Level 15, State 1, Procedure my_sp, Line 8 Incorrect syntax near '('.</p>
  </blockquote>
  
  <p>I have already created the procedure. (I'm not sure if that's relevant.) I was using a null default value and checking for that later, but that doesn't seem proper. Can I do this in one line?</p>
  
  <p><hr>
  Update: I was going off of <a href="http://msdn.microsoft.com/en-us/library/ms186755.aspx" rel="noreferrer" title="CREATE FUNCTION &#40;Transact-SQL&#41;">MSDN's description of stored procedure parameters</a>: </p>
  
  <blockquote>
    <p>[ = default ] Is a default value for the parameter. If a default value is defined, the function can be executed without specifying a value for that parameter. </p>
    
    <blockquote>
      <p>Note:<br>
      Default parameter values can be specified for CLR functions except for the varchar(max) and varbinary(max) data types.</p>
    </blockquote>
    
    <p>When a parameter of the function has a default value, the keyword DEFAULT must be specified when the function is called to retrieve the default value. This behavior is different from using parameters with default values in stored procedures in which omitting the parameter also implies the default value.</p>
  </blockquote>
  
  <p>Am I reading this wrong?</p>
  
  <p>Many thanks.</p>