title: convert int values to datetime in sql server
body: <p>I need to convert  the int values of a year, month and day in a datetime using sql server.</p>
  
  <p>actually i' am using this </p>
  
  <pre><code>DECLARE @MONTH INT
  DECLARE @YEAR INT
  DECLARE @DAY  INT
  DECLARE @MAXDATE DATETIME
  DECLARE @MINDATE DATETIME
  
  SET @MONTH=12
  SET @YEAR=2010
  SET @DAY=1
  
  
  SET @MINDATE=CONVERT(DATE,CAST (@YEAR AS VARCHAR)+ RIGHT ('0'+ CAST (@MONTH AS VARCHAR),2) + RIGHT ('0'+ CAST (@DAY AS VARCHAR),2))
  
  SELECT @MINDATE
  </code></pre>
  
  <p>and works ok, but i'm wondering if exist a better way to convert these values.</p>