From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Nageshwar Rao <NageshwarR(at)PLANETASIA(dot)COM> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Batching multiple CREATE TABLE commands |
Date: | 2004-11-19 09:34:28 |
Message-ID: | 419DBE24.3080903@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Nageshwar Rao wrote:
> Hi,
> I have set of create table statements. I need to execute them at one go
> instead of running individual statement to create a table.
> Help !
Nageshwar - two tips for posting to the mailing lists
1. Don't reply to an existing message with a new question
2. Make sure the subject line describes your question.
Otherwise, many people won't notice your question and you'll get less
people able to help.
As to the best way of executing multiple CREATE TABLE statements, that
depends on whether you are using psql or some other client. With psql
I'd put the statements in a file, then use something like:
psql -f my_commands.sql
psql < my_commands.sql
Or, if you're logged into psql you could use:
\i my_commands.sql
All covered in the man page for psql.
I always wrap the whole lot in BEGIN ... COMMIT so that if (usually
when) I make a mistake it rolls back all the changes.
HTH
--
Richard Huxton
Archonet Ltd
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Seymour | 2004-11-19 12:13:06 | Re: pgEdit public beta for Macintosh and Windows |
Previous Message | Premsun Choltanwanich | 2004-11-19 09:25:09 | How to make lo_import and lo_export to use file on client local machine? |