title: Query to pad left of a field with 0's
body: <p>I have been working on a query (in sql Server TSQL) which fills left of a number with 0's so output is always 5 digit.</p>
  
  <p>So:</p>
  
  <pre><code>Select MuNumber From Mytable
  </code></pre>
  
  <p>for data 11,011,2132,1111</p>
  
  <pre><code>Creates output like 
  00011
  02134
  01111
  </code></pre>
  
  <p>I tried Lpad Function but numer of 0's can be different.</p>
  
  <p>if Munumber is 1 we need 0000 and If MyNumber is 34 we need 000</p>