Re: Executing SQL commands in script files

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Susan Hoddinott" <susan(at)perth(dot)dialix(dot)com(dot)au>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Executing SQL commands in script files
Date: 2003-02-14 03:53:59
Message-ID: 200302131953.59989.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Susan,

> Following reading through all the documentation it is not clear to me how
> to run a script file containing a number of SQL commands. Presumably I do
> this through the psql interface but how do I tell it to run a script?

In PSQL:

\i filename

From the command line, or from cron:

Postgres_dir/bin/psql -U username database < scriptfile

Easy as cake!

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Weaver 2003-02-14 04:09:44 Passing arrays
Previous Message Joe Conway 2003-02-14 01:57:18 Re: [SQL] Returning result sets.