title: How to trim leading single quote and leading zeros from sql query
body: <p>I need to compare two columns in a sql table. The data in one column has a leading single quote and may have leading zeros and the other column may have leading zeros. I need to trim the leading zeros off one column and the leading quote and leading zeros on the other before I do the comparison. Is this Possible?</p>
  
  <pre><code>    F.RoutingNum
      123456
      234356
      014233
      233455
  
  
      T.RoutingNum
      '123456
      '234356
      '014233
      '0233455
  </code></pre>
  
  <p>I tried this but it does not trim to leading zeros off the T.RoutingNum column.</p>
  
  <pre><code>CASE 
      WHEN Replace(Ltrim(Replace(F.RoutingNum, '0', ' ')), ' ', '0') 
          &lt;&gt; SUBSTRING(Replace(Ltrim(Replace(T.RoutingNum, '0', ' ')), ' ', '0'), 2, 20) 
          THEN 'DO not match' 
      ELSE 'match'
  END
  </code></pre>