title: I need to convert an existing date field in SQL to Month and Year and place them in a new table in two new columns
body: <p>I have tried this already</p>
  
  <pre><code>INSERT INTO #TempTable (year, month, day)
  SELECT 
      DATEPART(yyyy, dtProc) as year,
      DATEPART(mm, dtProc) as month,
  FROM DailyHist
  </code></pre>
  
  <p>But after this insertion I need to insert more fields which then create NULL values for my recently inserted month and year fields, using this SQL statement:</p>
  
  <pre><code>INSERT INTO #TempTable(sCliNum, dtProc, sAssignNum, sCollectNum, cFees, cAdj1, cAdj2)
  SELECT 
      sCliNum, 
      dtProc, 
      sAssignNum, 
      sCollectNum, 
      cFees, 
      cAdj1, 
      cAdj2 
  FROM DailyHist
  </code></pre>
  
  <p>The DailyHist table layout is as follows:</p>
  
  <pre><code>sCliNum dtProc                  sAssignNum  sCollectNum    cFees   cAdj1       cAdj2
  ----------------------------------------------------------------------------------
  BADA    2011-02-01 00:00:00.000 ADJ         (Adj)          0.00    350402.30   0.00
  BADA    2011-02-01 00:00:00.000 INTERE      (Adj)          0.00        43.77   0.00
  </code></pre>
  
  <p>Here is what I'm trying to achieve</p>
  
  <pre><code>sCliNum dtProc  sAssignNum  sCollectNum cFees   cAdj1   cAdj2   year    month
  ------------------------------------------------------------------------------------
  COUN    2013-07-01 00:00:00.000     IntHis  0.00    0.00    0.00    NULL    NULL    NULL     
  COUN    2013-07-01 00:00:00.000 C1  FeeHis  0.00    0.00    0.00    NULL    NULL    NULL    
  </code></pre>
  
  <p>Please help!</p>
  
  <p>Thanks!</p>