1) Ensure that the CSV file is in the following format with first row containing column names.
Eg:- MyData.csv
Long,Lat,Alt
77.554428,12.912127,837
77.554428,12.91212,836
77.55442,12.912113,836
77.55442,12.912107,837
77.554413,12.912102,837
77.554405,12.912099,836
77.554405,12.912093,837
77.554398,12.912087,837
2) Create a Table with desired fields in PostGres
Eg:-
CREATE TABLE MyTable1
(
drlat double precision,
drlong double precision,
dralt double precision
)
WITH (OIDS=TRUE);
ALTER TABLE MyTable1 OWNER TO postgres
3) Use the following command to import the data from CSV file into PostGres table
COPY MyTable1 FROM E'C:\\MyData.csv' USING DELIMITERS ',' CSV HEADER;
No comments:
Post a Comment