title: Pad a string with leading zeros so it's 3 characters long in SQL Server 2008
body: <p>I have a string that is up to 3 characters long when it's first created in SQL Server 2008 R2.</p>
  
  <p>I would like to pad it with leading zeros, so if its original value was '1' then the new value would be '001'. Or if its original value was '23' the new value is '023'. Or if its original value is '124' then new value is the same as original value.</p>
  
  <p>I am using SQL Server 2008 R2. How would I do this using T-SQL?</p>