title: SQL Server - Assign default DateTime value to parameters in Stored Procedure
body: <p>Maybe I'm being an idiot here, but I'm trying to assign a default DateTime value to a Stored Procedure in MS SQL Server 2005 but can't get it to work eg:</p>
  
  <pre><code>CREATE PROCEDURE MyProcedure
  (
      @MyInteger    INT = 123,
      @MyDateTime   DATETIME = CONVERT(DATETIME, '1753-01-01 00:00:00', 20)
  )
  AS
  BEGIN ... (snip)
  </code></pre>
  
  <p>So if the <code>@MyDateTime</code> input parameter isn't specified, it should use '1753-01-01 00:00:00' by default, but I get the error...</p>
  
  <pre><code>Incorrect syntax near the keyword 'CONVERT'.
  </code></pre>
  
  <p>I can get it to work for Integers just fine. What am I doing wrong?</p>
  
  <hr>
  
  <p><strong>Edit:</strong> from the answers below, I eventually went with the following inside the Sproc itself:</p>
  
  <pre><code>CREATE PROCEDURE MyProcedure
  (
      @MyInteger    INT = 123,
      @MyDateTime   DATETIME = NULL
  )
  AS
  BEGIN
      SET NOCOUNT ON
  
      SET @MyDateTime = COALESCE(@MyDateTime, CONVERT(DATETIME, '1753-01-01 00:00:00', 20))
  
      ...snip...
  END
  </code></pre>