Thread: :) Import file2table Question
Good Morning, @^_^@ Could you please tell me .... 1 -How can I import a text file into Postgres table ? (append to the last row) -What is the format of that text file ? This is what I've done and its result.... ProjDB=> copy PrjTB from /prj_data/test.txt using delimiters , ProjDB-> ; ERROR: parser: syntax error at or near "/" 2 -What table field type that suits for 6-digit decimal number.. (i.e. 0.000000, 0.250001 , 0.123456 , ....)? I've defined this column with float4 and float8 but when I inserted data it returned this error message.. ProjDB=> insert into PrjTB values (0.000000,'red','Ln1') ProjDB->; ERROR: pg_atoi: error in "0.000000": can't parse ".000000" Thank You for your advance help, Korapat Charu.
Korapat Charukumnerdkanok wrote: >1 -How can I import a text file into Postgres table ? > (append to the last row) > > -What is the format of that text file ? > >This is what I've done and its result.... > >ProjDB=> copy PrjTB from /prj_data/test.txt using delimiters , >ProjDB-> ; >ERROR: parser: syntax error at or near "/" COPY ? Copies data between files and tables. COPY [BINARY] table [WITH OIDS] TO|FROM 'filename'|stdin|stdout [USING DELIMITERS 'delimiter'] Therefore: copy PrjTB from '/prj_data/test.txt' using delimiters ','; I don't know the answer to your second question. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight http://www.lfix.co.uk/oliver PGP key from public servers; key ID 32B8FAA1 ======================================== "Ask, and it shall be given you; seek, and ye shall find; knock, and it shall be opened unto you." Matthew 7:7