Remove returns and move address2 out of address

Description

In some Excel files, the address2 information will appear in the same column as the address, separated by a return. When you open the file in AccuZIP6, it will show the address and address2 information in the address field, with a box or two boxes in between. The command below creates a field named address2, strips out the boxes, and moves the address2 information into the address2 field.

The Command

ALTER TABLE ALIAS() ADD COLUMN ADDRESS2 C(60)
Replace all address with STRTRAN(address,CHR(13),"@")
Replace all address with STRTRAN(address,CHR(10),"@")
Replace all address with STRTRAN(address,"@@","@")
Replace address2 with ltrim(substr(address,at("@",alltrim(address))+1)), address with left(address,at("@",alltrim(address))-1) for occur("@",alltrim(address))>0

If you already have a field named Address2 in your database, you can delete the first line of the command, then run it. After running the command, everything to the right of the boxes will be moved into the field named address2, and the boxes will be removed from the address field.