How Do I Load Data to a Database Table from a Text File? (Magic xpa 3.x)
It is often useful to import data from a text file. This is useful when you are importing data from a spreadsheet, or from a file that you have previously exported (How Do I Dump Data from a Database Table to a Text File?). Magic xpa provides a utility to do this automatically, the Generate Program utility (Options->Generate Program, or Ctrl+G).
-
In the Data repository, position the cursor on the table you want to view.
-
Press Ctrl+G (Options->Generate Program).
-
Select:
-
Zoom from the Columns field to select only certain columns, if you want, and to change their order, if you want.
-
For Text file, enter the name of the text file you will import.
-
Press Enter or click OK.
If you selected Mode=Execute, the data will be imported from the text file you specified.
If you selected Mode=Generate, then there will be a new program in the Program repository. You can run this program by pressing F7.
Note: A plain text export can be very useful, but has some limitations. The particular problem happens to be memo fields which may contain a CR/LF, or BLOB fields. These sorts of files may require something more involved, such as XML input.