title: T-SQL: Best way to handle NULL values in string concatenation
body: <p>If in a SELECT statement I'm selecting a concatenated string that uses values from the table(s) I'm selecting from, what's the best way to handle NULLs for those values so that I still have my string? As in, if I'm selecting City, State, and Country for a User, and I want a third field that concatenates them all:</p>
  
  <pre><code>SELECT City, State, Country,
  City + ', ' + State + ', ' + Country AS 'Location'
  FROM Users
  </code></pre>
  
  <p>However, 'Location' is NULL if any of the three fields is NULL (which is happens whenever the user is not from the US).</p>
  
  <p>My current solution is this:</p>
  
  <pre><code>SELECT City, State, Country,
  City + ', ' + COALESCE(State + ', ', '') + Country AS 'Location'
  FROM Users
  </code></pre>
  
  <p>But I wasn't sure if this was just a hack and if there's a much better way to do it. Thoughts?</p>