title: SQL Server 2005 : If statement with return value
body: <p>I am trying to achieve simple task: select the value from 2 columns in a table.</p>
  
  <p>If one of the values is null then return null, or something.</p>
  
  <p>Else return the values.</p>
  
  <pre><code>SELECT 
      MobileAreaCode, Mobile 
  FROM 
      TABLE_NAME
  WHERE 
      id = 123456789
  
  IF (MobileAreaCode is NULL OR Mobile is NULL)
  BEGIN
     RETURN(1)--NULL
  END
  ELSE
  BEGIN
     RETURN(MobileAreaCode+Mobile)
  END
  </code></pre>
  
  <p>Help will be appreciated</p>