title: Find non-ASCII characters in varchar columns using SQL Server
body: <p>How can rows with non-ASCII characters be returned using SQL Server?<br>
  If you can show how to do it for one column would be great.  </p>
  
  <p>I am doing something like this now, but it is not working</p>
  
  <pre><code>select *
  from Staging.APARMRE1 as ar
  where ar.Line like '%[^!-~ ]%'
  </code></pre>
  
  <p><strong>For extra credit,</strong> if it can span <em>all</em> <code>varchar</code> columns in a table, that would be outstanding! In this solution, it would be nice to return three columns:</p>
  
  <ul>
  <li>The identity field for that record. (This will allow the whole record to be reviewed with another query.)</li>
  <li>The column name</li>
  <li>The text with the invalid character</li>
  </ul>
  
  <pre class="lang-none prettyprint-override"><code> Id | FieldName | InvalidText       |
  ----+-----------+-------------------+
   25 | LastName  | Solís             |
   56 | FirstName | François          |
  100 | Address1  | 123 Ümlaut street |
  </code></pre>
  
  <p>Invalid characters would be any outside the range of SPACE (32<sub>10</sub>) through <code>~</code> (127<sub>10</sub>)</p>