title: Stored Procedure parameter default value - is this a constant or a variable
body: <p>Here is my code:</p>
  
  <pre><code>USE [xxx]
  GO
  SET ANSI_NULLS ON
  GO
  SET QUOTED_IDENTIFIER ON
  GO
  
  CREATE PROCEDURE [dbo].[problemParam] 
      @StartDate INT = CONVERT(INT,(CONVERT(CHAR(8),GETDATE()-130,112))),
      @EndDate INT = NULL
  AS  
  BEGIN
  </code></pre>
  
  <p><code>SSMS</code> is not too happy with the <em>default</em> value I've used - in the <a href="http://msdn.microsoft.com/en-us/library/ms187926.aspx" rel="noreferrer"><strong>MSDN DEFINITION HERE</strong></a> it says that the default value needs to be a constant rather than a variable. </p>
  
  <p>Is <code>CONVERT(INT,(CONVERT(CHAR(8),GETDATE()-130,112)))</code> a variable or a constant? It's not a variable in the traditional way I think of a variable but then again it's not a constant like <code>'03 jan 2013'</code> is.  </p>
  
  <p>How do I get around this? Move <code>CONVERT(INT,(CONVERT(CHAR(8),GETDATE()-130,112)))</code> to the client that is calling the stored procedure?</p>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>Possible duplicate as I've just spotted this <a href="https://stackoverflow.com/questions/11885960/stored-procedure-parameter-default-value">SO POST</a></p>