MapInfo Products KnowledgeBase

Product: MapInfo
Version: 4.x\5.x\6.x
Platform: Win9x\NT\2000
Category: Table Operations

Summary:
Adding leading zeros to a character field.

Question:
How to add leading zeros to a character field?

Answer:
When a zip code field is imported into MapInfo as a number, the leading zeros will be eliminated causing bad results when geocoding. To fix this problem without re-importing, perform the following steps:

1. Choose Table>Maintenance>Table Structure and select the table to modify.

2. Change the type of the zip code column to character. Change the width to 5. If Zip+4, change it to Character with a width of 9.

The table will now look as follows:


3. Choose Table>Update Column and set up the dialog as follows:


4. Click on the OK button. The results will look as follows:


If the column was Zip+4, then use Right$("000000000" + ZIP, 9).

Note: If the table original table was from Excel, Lotus or ASCII txt, it would be necessary to save a copy of the table in MapInfo through File>Save Copy As under a new name. Then, it will be possible to modify the copy.

Last Modified: 11/10/2000 01:19:54 PM
Document URL: http://testdrive.mapinfo.com/techsupp/miprod.nsf/kbase_by_product/CCFC39B2A9F148D48525627C0038106E

Adding leading zeros to a character field.^CCFC39B2A9F148D48525627C0038106E^Y