title: How to trim the values passing the in clause of the select query
body: <p>Below is simple sql query to select records using in condition.</p>
  
  <pre><code>--like this I have 6000 usernames
  select * from tblUsers where Username in ('abc  ','xyz  ',' pqr  ',' mnop  ' );
  </code></pre>
  
  <p>I know there are <code>LTrim</code> &amp; <code>Rtrim</code> in sql to remove the leading trailing spaces form left &amp; right respectively.</p>
  
  <p>I want to remove the spaces from left &amp; right in all the usernames that I am supplying to the select query.</p>
  
  <p><strong>Note</strong>:- </p>
  
  <ul>
  <li><p>I want to trim the values that I am passing in the <code>in</code> clause.(<em>I don't want to pass LTrim &amp; RTrim to each value passed</em>).</p></li>
  <li><p>There are no trailing space in the records but  value that I am passing in the clause is copied from excel &amp; then pasted in Visual Studio. Then using ALT key I put '(single quote) at the left &amp; right sides of the string. Due to this some strings has spaces in the right side trailing.</p></li>
  </ul>
  
  <blockquote>
    <p>How to use the <code>trim</code> function in the select query?</p>
  </blockquote>
  
  <p>I am using MS SQL Server 2012</p>