Text String Leading Zeros

G

Guest

I have text strings in a field called HRID. I'm looking for a function that
will examine each item in HRID. If the length of the string equals 6, then
leave it as is. If less than 6, then add whatever number of leading zeros is
required to make the text string exactly 6 characters in length.

Any help would be appreciated!
 
D

Dirk Goldgar

Kirk P. said:
I have text strings in a field called HRID. I'm looking for a
function that will examine each item in HRID. If the length of the
string equals 6, then leave it as is. If less than 6, then add
whatever number of leading zeros is required to make the text string
exactly 6 characters in length.

Any help would be appreciated!

UPDATE YourTable
SET HRID = Right("000000" & HRID, 6);
 
M

Marshall Barton

Kirk said:
I have text strings in a field called HRID. I'm looking for a function that
will examine each item in HRID. If the length of the string equals 6, then
leave it as is. If less than 6, then add whatever number of leading zeros is
required to make the text string exactly 6 characters in length.


Right("000000" & HRID, 6)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top