[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: quicky postgreSQL question



On 25-Nov-98 Eric Jacoboni wrote:
> Shaleh <shaleh@livenet.net> writes:
> 
>> How can I read in a comma delimited file and have the contents added to a
>> SQL
>> table?  I seem to recall there being a program that did this for postgres.
> 
> I'm not sure to have understood what you mean, but in psql, you can
> issue a "\copy table from file"... file is made of one line per tuple, 
> each column is, by default, separated of the next column whith a tab
> character. You can change this separator as you want with the \f
> command.
> 

That is exactly what I wanted thank you.  

db=> copy stdcal from /vservers/stdcal/users/root/gem_inv.txt using delimeters
,;

the database is db, the table is stdcal, the file contains the wanted data.

When I run this I get a "parse error at or near "/"".  \h copy says this is the
right syntax.  Suggecstions?


Reply to: