title: Concatenate 2 dates in MS SQL
body: <p>I wanted to concatenate 2 dates below but I am getting an error that</p>
  <pre><code>Msg 402, Level 16, State 1, Line 3
  The data types date and varchar are incompatible in the add operator.
  </code></pre>
  <p>My Code is:</p>
  <pre><code>SELECT  DATEADD(DAY, -7 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)) [WeekStart],
      DATEADD(DAY, -1 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)) [WeekEnd],
      (DATEADD(DAY, -7 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)) + ' to ' +  DATEADD(DAY, -1 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE))) as Week
  </code></pre>
  <p>Expected result:</p>
  <pre><code>WeekStart   WeekEnd      WeekRange
  2015-09-27  2015-10-03   2015-09-27 to 2015-10-03
  </code></pre>
  <hr />
  <h3>Resolved</h3>
  <p>[Resolved] used convert:</p>
  <pre><code>SELECT  DATEADD(DAY, -7 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)) [WeekStart],
      DATEADD(DAY, -1 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)) [WeekEnd],
      convert(varchar(10),DATEADD(DAY, -7 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)),110) + ' TO ' +  convert(varchar(10),DATEADD(DAY, -1 - DATEPART(WEEKDAY, GETDATE()), CAST(GETDATE() AS DATE)),110) as Week
      
  </code></pre>