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

How to read a csv file in Pervasive?

Status
Not open for further replies.

profoundhypnotic

Programmer
Mar 3, 2022
2
0
0
US
Hello,

I have a project where we have a csv with two columns of data. This will be run from a task so I don't want to have to manually import the data each time it runs. I need to read the file, update a column in a table (with the first column value in the csv) based on the value in column 2 of the csv. I thought maybe I could just read the file in pervasive SQL but I think it would have to load into a temp table or a table I create for this purpose. The problem is, idk how to read in the file. I thought the sql command below would work based on the MYSQL documentation but I can't actually find documentation for LOAD DATA for PSQL. Is this not possible in PSQL?

Queries I've tried:
LOAD DATA INFILE 'file_path.csv'
LOAD DATA LOCAL INFILE 'file_path.csv'
The error I get is SQL ENGINE SYnatx Error: LOAD <<???>>> DATA

EDIT:
I found the bdu utility but that hasn't helped yet. I get an error 3392: Cannot open DBNAMES.CFG file
EDIT 2:
I found that you have to run BDU from the server not the client so I was able to import from csv. Is there another way or is this the only way other than the import wizard?
 
The queries you've tried won't work because Pervasive doesn't support them.
What is the command line you are using for the BDU. BDU must be run where the Pervasive engine is running. If you are running it on the client, you will get the "error 3392: Cannot open DBNAMES.CFG file" message.
An example command for BDU would be:
Code:
BDU.EXE DEMODATA Student testfile.txt -t,
where DEMODATA is the database name, Student is the table name, testfile.txt is the flat file to be read, and the -t is the field delimiter and is set to comma (",") in the example.
The documentation for BDU in Zen v15 is at

Mirtheil
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top