title: TSQL 2008 Using LTrim(RTrim and still have spaces in the data
body: <p>I have data I cleaning up in an old data table prior to moving it to a new one. One of the fields has spaces in the column, right &amp; left. I wrote the following code to address this and still have leading spaces?? The bulk of the data is clean when using this code but for some reason there are spaces prior to RT addresses...   Has anyone else had this type of issue? </p>
  
  <pre><code>,CASE   
  WHEN PropStreetAddr IS NOT NULL
   THEN  (CONVERT(VARCHAR(28),PropStreetAddr))  
  WHEN PropStreetAddr is NOT NULL Then  (Select LTrim(RTrim(PropStreetAddr)) As PropStreetAddr)
       ELSE NULL END  as 'PROPERTY_STREET_ADDRESS'
  </code></pre>
  
  <p>Sample output data:</p>
  
  <pre><code>1234 20th St 
    RT 1 BOX 2  
  560 King St  
  610 Nowland Rd  
    RT 1  
  1085 YouAreHere Ln  
    RT 24 Box 12  
  </code></pre>