Reputation: 33
Could someone help me find a way to read data from a .csv
file and then store it in a table in openedge.
INPUT FROM ‘c:\sample.csv’.
REPEAT:
CREATE customer.
IMPORT DELIMITER "," cust-num name sales-rep.
END.
OUTPUT CLOSE.
This is the code that I tried but its not getting executed!
Upvotes: 2
Views: 2493
Reputation: 436
INPUT FROM c:\sample.csv.
REPEAT:
CREATE customer.
IMPORT DELIMITER "," customer.cust-num customer.name customer.sales-rep.
END.
OUTPUT CLOSE.
Remove the quotes from around your file name. Escape characters aren't needed for the blackslash since you are running on Windows and not Unix.
If you need to use a variable for the file name then you would use INPUT FROM VALUE(myvariable).
Upvotes: 2
Reputation: 14020
The "\" is an "escape" character. Escape the escape by doubling it or (preferably) by using the alternate escape of "~".
Input from 'c:~\sample.csv'.
Upvotes: 2