multiple psql commands in batch

From: Tobias Boes <tobias(dot)boes(at)gmx(dot)de>
To: pgsql-novice(at)postgresql(dot)org
Subject: multiple psql commands in batch
Date: 2006-06-02 18:28:18
Message-ID: 20060602182818.278260@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

G'Day all,

i know that this issues was discussed multiple time, but i still stuck in processing multiple pgsql commands in a DOS batch file.
I want to create a user, than a database with the following command:
C:\financial-planner\pgsql\bin\psql.exe -U postgres < create_user_and_db.sql

this scceeds. in the create_user_and_db.sql I stored the SQL-commands to setup the database and the database user.
but afterwards I want to switch to "mydatabase" and process the create table statements. In the pgsql shell I can switch to "mydatabase" with the following command:
\c mydatabase
but how can I run mulitple pgsql commands in a batch job? After loads of reading I'm still not able to do this.
Any help is really appreciated!
Thanks,
Tobias
--

Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Daniel T. Staal 2006-06-02 18:41:13 Re: multiple psql commands in batch
Previous Message Andreas Burkhardt 2006-06-02 17:43:38 Creating users with name and email