title: How do I extract month two digits varchar from data? SQL 2012
body: <p>This is my data set </p>
  
  <p><a href="https://i.stack.imgur.com/JFvuJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JFvuJ.png" alt="data"></a></p>
  
  <p>I am making a stored procedure and the column is in varchar. I have tried to convert to datetime but wasn't successful to do it... I am trying to extract just the month in two digits eg. 01,02,03 to make a table like this.</p>
  
  <p><a href="https://i.stack.imgur.com/bc5e5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bc5e5.png" alt="table"></a></p>
  
  <pre><code>CREATE Proc qe 
  AS
  BEGIN
  
  SELECT LEFT(CREATED_TIME,4) AS 'YEAR' , COUNT(*) AS 'NO OF POSTS'
  FROM Sheet1$ 
  GROUP BY  LEFT(CREATED_TIME,4)
  
  /**SELECT LEFT(CREATED_TIME,7 (RIGHT CREATED_TIME,19))  AS 'MONTH',        
  COUNT(*) AS 'NO OF POSTS'
  FROM Sheet1$ 
  GROUP BY LEFT(CREATED_TIME,7 (RIGHT CREATED_TIME,19))**/
  
  END 
  
  EXEC qe
  </code></pre>
  
  <p>How do I extract month eg. 01, 02, 03 it staying in varchar? No converting? I really appreciate your help!!!</p>