title: Using Derived Column to create a date value in the format YYYY-MM-01 00:00:00.000 for each row
body: <p>Im having a problem with derived columns in SSIS.  When in SSMS i can set a column to have a default value using the following code:</p>
  
  <pre><code>(dateadd(month,datediff(month,(0),getdate())-(1),(0)))
  </code></pre>
  
  <p>and when data is entered into the database it will give it the timestamp of the previous month in the following format for example:</p>
  
  <pre><code> 2010-09-01 00:00:00.000
  </code></pre>
  
  <p>This strangely is what im looking for and trying to duplicate/produce similar using the Derived Column DFT.</p>
  
  <p>So far i have:</p>
  
  <pre><code>DATEADD("mm",DATEDIFF("mm",GETDATE(),GETDATE()) - 1,GETDATE())
  </code></pre>
  
  <p>which produces the month succesfully but the GETDATE() is not a correct replacement for the 0's in the original code.</p>
  
  <p>Does the 0's in the original code signify the start date in SQL?</p>
  
  <p>Any help would be much appreciated.</p>
  
  <p>Regards,</p>
  
  <p>Lee</p>