pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
batch file
7+ messages / 7 participants
[nested] [flat]

* batch file
@ 2001-05-25 17:38  Milen <milend@ansco.com>
  0 siblings, 5 replies; 7+ messages in thread

From: Milen @ 2001-05-25 17:38 UTC (permalink / raw)
  To: pgsql-sql

Hi all!,

I want to execute several SQL statements one after another.
Does anyone know if it is possible to create something like a "batch file" 
which contains all SQL commands I want.

Best Regards:
Milen



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: batch file
@ 2001-05-25 17:53  Jason Earl <jdearl@yahoo.com>
  parent: Milen <milend@ansco.com>
  4 siblings, 0 replies; 7+ messages in thread

From: Jason Earl @ 2001-05-25 17:53 UTC (permalink / raw)
  To: Milen <milend@ansco.com>; pgsql-sql


I just put files commands that I want in some file
like "foo.sql" and then do:

psql mydatabase -f foo.sql

Is this what you are looking for?

Jason


--- Milen <milend@ansco.com> wrote:
> Hi all!,
> 
> I want to execute several SQL statements one after
> another.
> Does anyone know if it is possible to create
> something like a "batch file" 
> which contains all SQL commands I want.
> 
> Best Regards:
> Milen
> 
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: batch file
@ 2001-05-25 18:04  Jie Liang <jliang@ipinc.com>
  parent: Milen <milend@ansco.com>
  4 siblings, 0 replies; 7+ messages in thread

From: Jie Liang @ 2001-05-25 18:04 UTC (permalink / raw)
  To: Milen <milend@ansco.com>; +Cc: pgsql-sql

Hi,

I am not sure what's your question.
However, you can list a bunch of SQL statements in a text file:
e.g.
myfile.sql which contains:

select * from tablename where ....
update tablename set ... where ...
.....

then, you can just run it like:


psql -q dbname < myfile.sql




Jie LIANG

St. Bernard Software

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.stbernard.com
www.ipinc.com

On Fri, 25 May 2001, Milen wrote:

> Hi all!,
> 
> I want to execute several SQL statements one after another.
> Does anyone know if it is possible to create something like a "batch file" 
> which contains all SQL commands I want.
> 
> Best Regards:
> Milen
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
> 
> http://www.postgresql.org/users-lounge/docs/faq.html
> 




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: batch file
@ 2001-05-25 18:11  Peter Eisentraut <peter_e@gmx.net>
  parent: Milen <milend@ansco.com>
  4 siblings, 1 reply; 7+ messages in thread

From: Peter Eisentraut @ 2001-05-25 18:11 UTC (permalink / raw)
  To: Milen <milend@ansco.com>; +Cc: pgsql-sql

Milen writes:

> I want to execute several SQL statements one after another.
> Does anyone know if it is possible to create something like a "batch file"
> which contains all SQL commands I want.

psql [options] -f yourfile.sql

-- 
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: batch file
@ 2001-05-25 18:19  Richard Huxton <dev@archonet.com>
  parent: Milen <milend@ansco.com>
  4 siblings, 0 replies; 7+ messages in thread

From: Richard Huxton @ 2001-05-25 18:19 UTC (permalink / raw)
  To: Milen <milend@ansco.com>; pgsql-sql

From: "Milen" <milend@ansco.com>
> I want to execute several SQL statements one after another.
> Does anyone know if it is possible to create something like a "batch file"
> which contains all SQL commands I want.

You can do exactly that.

Use "man psql" to find out about the -f option or the \i option.

- Richard Huxton




^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: batch file
@ 2001-05-27 20:12  bugi <bakarat@poczta.wp.pl>
  parent: Milen <milend@ansco.com>
  4 siblings, 0 replies; 7+ messages in thread

From: bugi @ 2001-05-27 20:12 UTC (permalink / raw)
  To: pgsql-sql

Create the file for example command.sql and log into the  database psql
mydbase
and write command
\i command.sql

U¿ytkownik "Milen" <milend@ansco.com> napisa³ w wiadomo¶ci
news:01C0E51F.F2E673F0.milend@ansco.com...
> Hi all!,
>
> I want to execute several SQL statements one after another.
> Does anyone know if it is possible to create something like a "batch file"
> which contains all SQL commands I want.
>
> Best Regards:
> Milen
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: batch file
@ 2001-05-30 01:07  Grant <grant@conprojan.com.au>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 0 replies; 7+ messages in thread

From: Grant @ 2001-05-30 01:07 UTC (permalink / raw)
  To: pgsql-sql

> I want to execute several SQL statements one after another.
> Does anyone know if it is possible to create something like a "batch file"
> which contains all SQL commands I want.

That or just separate commands by a semi colon:

select * from table1; select * from table2;




^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2001-05-30 01:07 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-25 17:38 batch file Milen <milend@ansco.com>
2001-05-25 17:53 ` Jason Earl <jdearl@yahoo.com>
2001-05-25 18:04 ` Jie Liang <jliang@ipinc.com>
2001-05-25 18:11 ` Peter Eisentraut <peter_e@gmx.net>
2001-05-30 01:07   ` Grant <grant@conprojan.com.au>
2001-05-25 18:19 ` Richard Huxton <dev@archonet.com>
2001-05-27 20:12 ` bugi <bakarat@poczta.wp.pl>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox