title: Pad a number with zeros, but only if it's below a certain length?
body: <p>I have numbers that must be at least 7 digits long. For example:</p>
  
  <pre><code>0000001
  123456789
  0012345
  </code></pre>
  
  <p>Are all valid. I only need to pad the number with 0's only if its length is below 7. How do I do this in SQL Server? The best I've been able to get is to pad the number if the length is less than 7, but above that, it starts to truncate the number instead.</p>