Probably a newb question, but...
I have a table with a VARCHAR field containing numbers 1 through 300. I need to place a leading zero in front of any numbers less than 10 while retaining the original number if it is 10 or greater (i.e. 1=01, 10=10 and 300=300).
SELECT DISTINCT RIGHT('0'+CONVERT(VARCHAR,[FacilityCode]),3) FROM...
This returns 1=01, 10=010 and 300=300 (using the same examples as above)
EDIT: I'm trying to do this within a query so that I can do lookups without altering either table.
Can someone lend a brother a hand here? My brain just ain't working.
1
to be001
? – RolandoMySQLDBA Jul 24 '14 at 15:20