title: coalesce VS isnull
body: <p>can anyone give me explain about difference coalesce and isnull in sql server ?</p>
  
  <p>I was query with isnull for get a value in my localhost database and work fine but not worked on my server with isnull
  I use coalesce and it's worked in my server</p>
  
  <p>This is on my database localhost</p>
  
  <pre><code>set @QQ = ISNULL( (select max(qq) from ods4..dbmassignsalescustprod where salesname = '{UserID}'),
                (select max(qq) from ods4..dbmassignsalescustprod))
  </code></pre>
  
  <p>This is on my database server</p>
  
  <pre><code>set @QQ = COALESCE( (select max(qq) from ods4..dbmassignsalescustprod where salesname = '{UserID}'),
                (select max(qq) from ods4..dbmassignsalescustprod))
  </code></pre>
  
  <p>On my database server I use isnull and that value cannot be get to QQ variable
  谢谢 고맙습니다</p>