Обсуждение: [Question]batch execute sql command

Поиск
Список
Период
Сортировка

[Question]batch execute sql command

От
neo anderson
Дата:
Hi,
i encounter a question when create database schema.
because i have a sql script, in which contains lots of
sql command, including insert, create table, create
index and so on. however, i do know weather postgresql
supports batch executing sql script or not, for i try
to run scrtip like what oracle does; yet it seemly
doesn't  work. would anyone please to telll me how to
do that? (i read the document -
http://www.postgresql.org/docs/8.0/static/index.html -
but seemly there ain't no such description in it)
i appreciate any suggestion, sincerely.
jason

Send instant messages to your online friends http://uk.messenger.yahoo.com

Re: [Question]batch execute sql command

От
Michael Fuhr
Дата:
On Sun, Apr 24, 2005 at 02:08:33PM +0100, neo anderson wrote:
>
> i encounter a question when create database schema.
> because i have a sql script, in which contains lots of
> sql command, including insert, create table, create
> index and so on. however, i do know weather postgresql
> supports batch executing sql script or not, for i try
> to run scrtip like what oracle does; yet it seemly
> doesn't  work. would anyone please to telll me how to
> do that?

From within psql you can run "\i filename"; from the command line
you can run "psql -f filename" or, if your shell supports redirection,
"psql < filename".  See the psql documentation for details:

http://www.postgresql.org/docs/8.0/interactive/app-psql.html

If that's not what you're looking for, then please provide more
information about what you're trying to do.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/