Re: load sql from the file in postgresql

From: Dennis Grimm <Dennis(dot)Grimm(at)helpsystems(dot)com>
To: Sukuchha Shrestha <sukuchha(at)yahoo(dot)de>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: load sql from the file in postgresql
Date: 2011-04-29 16:06:36
Message-ID: 5C3D256BE93D9A40954530860071788CF82DE151@exchep1
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Try using this, even on a windows system:

\i /psql/loaddata.sql

psql likes *nix path names
________________________________
From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Sukuchha Shrestha
Sent: Friday, April 29, 2011 5:40 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] load sql from the file in postgresql

hello group,

I just started to use postgresql and i want to import data using copy command in a loop.

Here is what i did !

1) following content with name loaddata.sql.
\copy table from 'C:\psql\x.txt';
\copy table from 'C:\psql\y.txt';

2) My loaddata.sql is located in C:\psql\ therefore i tried to call the loaddata.sql in psql like

\i C:\psql\loaddata.sql

But it says " C:: Permission denied"

What is a problem ? Please guide me ! Is there any better way to call copy commad in a loop with varying filename!

regards
Sukuchha

_______________

Confidentiality Notice: This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to
which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately.

________________

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mark 2011-04-29 17:04:38 Re: GIN index not used
Previous Message fork 2011-04-29 16:05:10 Re: schemas for organizing tables