title: SQL: Text and datetime type in when-then statement
body: <p>I have this </p>
  
  <pre><code> case 
    when var1 is null then 'Some text'
    when var1 is not null then var2
   end AS [Some_Name],
  </code></pre>
  
  <p>var1 is an integer and var2 is a datetime and then I have this error: "Conversion failed when converting date and/or tiem from character string.</p>
  
  <p>Who do I do this correctly?</p>