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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inport Text File to VFP6 DBF in command line?

Status
Not open for further replies.

sdmi

Programmer
Dec 6, 2001
17
US
If it possible, can I import text file to FoxPro table using
command line?
 
If all you want to do is import a complete text file into a single record of a table it can be done real easy with the APPEND MEMO command.
 
Look at the 'APPEND FROM' command

Example I use APPEND FROM c:\myfile.txt SDF


APPEND FROM FileName | ? [FIELDS FieldList] [FOR lExpression]
[[TYPE] [DELIMITED [WITH Delimiter | WITH BLANK | WITH TAB
| WITH CHARACTER Delimiter] | DIF | FW2 | MOD | PDOX | RPD |
SDF | SYLK | WK1 | WK3 | WKS | WR1 | WRK | CSV | XLS | XL5
[SHEET cSheetName] | XL8 [SHEET cSheetName]]] [AS nCodePage]
 
Hi

SELECT 0
USE myTable
APPEND FROMmyText.txt SDF

An SDF file is an ASCII text file in which records have a fixed length and end with a carriage return and line feed. Fields are not delimited. The file name extension is assumed to be .txt for SDF files.
Effective conversion of date data from SDF files to Visual FoxPro tables requires data to be stored in YYYYMMDD format.

If date information is stored in ambiguous formats, you should map the date column to a character column of appropriate width so you can inspect the value then apply the correct conversion routine to create correctly formatted date data.

If you want the entire text file in a variable...

myText = FILETOSTR("myFile.txt")

Then sav it where you want with a simple REPLACE command..
Replace myField WITH myText
ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
I am not sure any of the above answers are addressing the question asked ?

Here is the question ...

If it possible, can I import text file to FoxPro table using
command line?

I read many solutions using the Command WINDOW but nothing using command LINE.

I assume a command LINE solution means from the DOS command line prompt.

Am I wrong ?

If so, my apologies ... and all those solutions are just fine.
Don
dond@csrinc.com

 
Don,
If he is really asking about using a COMMAND Line solution, it wouldn't be that hard to create a simple program to parse out the information and then build and run the appropriate statement.

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top