简体   繁体   中英

How to read data from a .csv file and store it in a table in openedge

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!

The "\\" is an "escape" character. Escape the escape by doubling it or (preferably) by using the alternate escape of "~".

Input from 'c:~\\sample.csv'.

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM