Re: command line v GUI and COPY

Поиск
Список
Период
Сортировка
От John Polo
Тема Re: command line v GUI and COPY
Дата
Msg-id 543D8CC2.9090403@okstate.edu
обсуждение исходный текст
Ответ на Re: command line v GUI and COPY  (jared <afonit@gmail.com>)
Ответы Re: command line v GUI and COPY  (jared <afonit@gmail.com>)
Список pgsql-novice
Jared,
The error came up when I was trying to use pgadmin (GUI) and mouse and menus that opened up with right-clicks. I opened psql and typed it all as you did and it worked. Thank you. I have _many_ more CSVs and it would easier to do this through a GUI or some other way that won't involve as much typing. And that's just the FIA data I downloaded. I have a bunch of GIS data that I want to start building another DB with. But this is a start.

John

On 10/14/2014 2:03 PM, jared wrote:


On Tue, Oct 14, 2014 at 2:40 PM, John Polo <polo@okstate.edu> wrote:
 
This is how the data originally appears in the file. The error says it was in row 2. It looked like there was an extra pair of quotes and then an odd quote at the very end.
"CN","PLT_CN","INVYR","STATECD","UNITCD","COUNTYCD","PLOT","SUBP","SUBPTYP","BNDCHG","CONTRAST","AZMLEFT","AZMCORN","DISTCORN","AZMRIGHT","CYCLE","SUBCYCLE","CREATED_BY","CREATED_DATE","CREATED_IN_INSTANCE","MODIFIED_BY","MODIFIED_DATE","MODIFIED_IN_INSTANCE"
"202492243010854","157287634010478",2008,40,1,5,131,2,1,,2,276,0,,70,7,1,"",2011-05-02,"10854","",,""


John

Hey John,
Maybe I am misunderstanding, but that copied into a table fine, did you paste the correct row into the email?

I placed the text you provided than executed:


create table test
(
CN  character varying,
PLT_CN  character varying,
INVYR  character varying,
STATECD  character varying,
UNITCD  character varying,
COUNTYCD  character varying,
PLOT  character varying,
SUBP  character varying,
SUBPTYP  character varying,
BNDCHG  character varying,
CONTRAST  character varying,
AZMLEFT  character varying,
AZMCORN  character varying,
DISTCORN  character varying,
AZMRIGHT  character varying,
CYCLE  character varying,
SUBCYCLE  character varying,
CREATED_BY  character varying,
CREATED_DATE  date,
CREATED_IN_INSTANCE  character varying,
MODIFIED_BY  character varying,
MODIFIED_DATE  character varying,
MODIFIED_IN_INSTANCE  character varying
);

copy test
from '/for_import/test_data.txt'
with delimiter as ','
csv header
null as '';


And everything came through without errors.

В списке pgsql-novice по дате отправления:

Предыдущее
От: jared
Дата:
Сообщение: Re: command line v GUI and COPY
Следующее
От: jared
Дата:
Сообщение: Re: command line v GUI and COPY