title: sql - value is 0 but return empty cell
body: <p>i am currently doing some data testing, so i want to export my file into my local (into excel format) but there is column AGE in my file, where if the age value = 0, it return as blank cell (i want it to return 0) in excel after mapping completed. it return other value accordingly (ex: 1,2,3,4) except for 0 value. i am sure i should use ISNULL() for this, but i can't get it to save 0 instead of blank cell.</p>
  
  <p>PS/: AGE is a calculation of a YEAR
  deprStartDate is a VARCHAR column</p>
  
  <p>my code currently</p>
  
  <p><code>year(getdate()) - CAST(ISNULL(right(LTRIM(RTRIM(REPLACE(REPLACE(pcld.[deprStartDate], CHAR(13), ''), CHAR(10), ''))),4),0) AS VARCHAR) as [AGE]</code></p>
  
  <p>other things that ive tried so far is using COALESCE</p>
  
  <p><code>year(getdate()) - COALESCE(CAST(right(LTRIM(RTRIM(REPLACE(REPLACE(pcld.[deprStartDate], CHAR(13), ''), CHAR(10), ''))),4) AS INT),'') as [AGE]</code></p>
  
  <p>i am sure this is the right function for getting the 0, but i am not sure if i did in the correct way.. Need someone to help me out, cause i am really new to SQL. Thank a lot.</p>