title: Why we can't set default value of datetime parameter in stored procedure = getDate()?
body: <p>I want to know why I can't set default value to SP datetime parameter to getdate() as below :</p>
  
  <pre><code>Create PROCEDURE [dbo].[UPILog]
  (
      @UserID bigint,
      @ActionID smallint,
      @Details nvarchar(MAX) = null,
      @Created datetime = getdate()
  )
  </code></pre>
  
  <p>if I try to save it will give me a compiler error</p>
  
  <pre><code>    Msg 102, Level 15, State 1, Procedure UPILog, Line XX
      Incorrect syntax near '('.
  </code></pre>
  
  <p><strong>EDIT :</strong>
  I know that i can do it like below</p>
  
  <pre><code>Create PROCEDURE [dbo].[UPILog]
  (
      @UserID bigint,
      @ActionID smallint,
      @Details nvarchar(MAX) = null,
      @Created datetime = null
  )
  AS
  if @Created is null
      SET @Created=getdate() ...
  </code></pre>