Friday, March 9, 2012

Formating

I am creating an extraction routine and need to pull out an invoice number
from a table. However as part of transferring this to a new system I need to
add leading zeroes to the front of the field.
eg 456 into 000456.
I`m sure I am having brain fade here but can`t think of the way to do this.
Any help gratefully received.SELECT RIGHT('000000' + CONVERT(varchar(20),456),6)
HTH, Jens Suessmeyer.

No comments:

Post a Comment