Pad a string with leading zeros so it’s 3 characters long in SQL Server 2008
If the field is already a string, this will work If you want nulls to show as ‘000’ It might be an integer — then you would want As required by the question this answer only works if the length <= 3, if you want something larger you need to change the string constant and … Read more