Importing a comma-delimited text file
Importing a comma-delimited text file
От:
Conrad Lawes <clawes@home.com>
Дата:
What is the command to import data into a table from comma-delimited text file? Unfortunately, the psql on-line help (\h) does not provide a clear explanation. Thanks.
Re: Importing a comma-delimited text file
От:
Julie Hunt <jhunt@chac.qld.edu.au>
Дата:
Hi I use the following that I wrote for unix type scenario named insert_data. You can use this then copy any file into any database either tab or comma separated within bash. If you don't want to use this the syntax for copying data into a table is included in this script. #!/bin/bash # Procedure to insert data from bash to a table in a database # valid options:- -ti (tab-separated, insert); # -tr (tab-separated, replace all existing data); # -ci (comma-separated, insert); # -cr (comma-separated, replace); # . insert_data -
Re: Importing a comma-delimited text file
От:
"James R. R. Service" <jservice@yahoo.com>
Дата:
Conrad Lawes wrote: > > What is the command to import data into a table from comma-delimited > text file? > Unfortunately, the psql on-line help (\h) does not provide a clear > explanation. Try COPY. The delimiter is "," in your case rather than the default \t. For details see: http://alibaba.dei.uminho.pt/psql/postgres/sql-copy.htm -- James (Jim) R.R. Service jservice at yahoo dot com
RE: Importing a comma-delimited text file
От:
"Culberson, Philip" <philip.culberson@dat.com>
Дата:
With your Postgres distribution should have come a number of PDF files. These are a far better source of information than the \h of psql. They can be found in the /doc directory of the distribution tree. For your question, look in the user.pdf file. Briefly, the command would look like: COPY table_name FROM '/foo/bar/myfile.txt' USING DELIMITERS ','; Phil Culberson DAT Services -----Original Message----- From: Conrad Lawes [mailto:clawes@home.com] Sent: Tuesday, April 11, 2000 5:37 AM To: pgsql-questions@postgresql.org Subject: [GENERAL] Importing a comma-delimited text file What is the command to import data into a table from comma-delimited text file? Unfortunately, the psql on-line help (\h) does not provide a clear explanation. Thanks.