title: SQL Server trim function
body: <p>I have a problem in SQL Server. I want to remove space using Ltrim and Rtrim.</p>
  
  <p>My query is like this</p>
  
  <pre><code>select len('test        ')
  </code></pre>
  
  <p>Return 6</p>
  
  <pre><code>select len(rtrim(ltrim('test        ')))
  </code></pre>
  
  <p>Return 6</p>
  
  <p>Why Its not Removing space?</p>
  
  <p>I have checked the ascii values for this space is 32.</p>
  
  <p>Any help?</p>
  
  <p>Thank you</p>