title: TSQL NVARCHAR Conversion Error inside CASE statement
body: <p>This select is driving me crazy.<br>
  The error is:  </p>
  
  <blockquote>
    <p>Conversion error converting nvarchar value '17.30 h' to int data type.</p>
  </blockquote>
  
  <p>Data is:</p>
  
  <pre><code>(DateTime)   (Nvarchar)  (DateTime)
  DATAINICI    DATAMANUAL  DATAFI
  null         17.30 h     10/01/2015
  01/01/2015   20.30 h     null
  </code></pre>
  
  <p>And the statement is:</p>
  
  <pre><code>CASE WHEN  dbo.Activitat.DataInici is null 
  THEN DATEPART(DAY,Activitat.Datafi) 
  ELSE CONVERT(NVARCHAR(50), dbo.Activitat.DataManual)
  END 
  </code></pre>