title: Setting a parameter inside a date
body: <p>I'm writing a script in SQL Server that should insert some data (DUH).</p>
  
  <p>My problem is that the MONTH of the date (the one in bold) has to be SET every time to a different month.</p>
  
  <p>It should be something like '2011-@month-27', but that doesn't work of course.</p>
  
  <p>Here's the script:</p>
  
  <pre><code>USE xxx
  
  DECLARE @Month int;
  DECLARE @DateToCopy datetime;
  
  SET **@Month = 09**  -- The month
  SET @DateToCopy = CONVERT(DATETIME, '2011-10-27 00:00:00', 102)  -- The date to copy
  
  BEGIN TRANSACTION
  
  INSERT INTO Z_T_CurrencyRate_Test (CurrencyID, RateDate, RateToMain, RateToSec, CurrencyRate)
      SELECT CurrencyID, **CONVERT(DATETIME, '2011-10-27 00:00:00', 102)**, RateToMain, RateToSec, CurrencyRate 
      FROM T_CurrencyRate
      WHERE (RateDate = @DateToCopy)
  
  COMMIT TRANSACTION
  </code></pre>