Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add leading zero

Status
Not open for further replies.

Quempel

MIS
Jun 23, 2005
15
US
I am looking for help on creating a query that will add a zero to an account number if it is less then 10 digits.

Any help would be much appreciated.

Thnx
Q

 

=iif(len(account)>10,"0" & account,account)
 
O.k....I guess maybe I should explain this a bit further...

I am importing a csv file into a table. I want to make a query that will update the account # to 10 digits if it is less then 10.
 
something like this:

Update yourTable
SET AccountNumber = right('0000000000'+AccountNumber,10)

-DNG

 
Hi!

Try this:

UPDATE YourTable SET YourTable.AccountNumber = Format([YourTable.AccountNumber],"0000000000");

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Thank you...That worked.

You have been very helpful.
 
This is what I ended up using:

Right('0000000000'+[Account],10)

Thnx again

Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top