leading zeroes

  • Thread starter ljubo lecic via AccessMonster.com
  • Start date
L

ljubo lecic via AccessMonster.com

I have a table with two columns.(A Number, B text (13 char in size))
I need to write an update query which would make column B
to look like column A but with leading zeroes.
For example:
If A = 1234 B should be 0000000001234 or
If A = 1 B should be 0000000000001

Thanks in advance!
 
K

Ken Snell [MVP]

Do you need to store redundant data? Not usually a good practice.

You can always display the second format via a query using a calculated
field:

SELECT FieldA, Right("0000000000000" & [FieldA], 13) AS FieldB
FROM TableName;
 
O

Ofer

The query should look like that

UPDATE MyTableName SET B = Format([A],"0000000000000");
 
Top