Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f26Jl6x67690 for ; Tue, 6 Mar 2001 14:47:06 -0500 (EST) (envelope-from pgsql-sql-owner@postgresql.org) Received: from smtpsrv1.isis.unc.edu (smtpsrv1.isis.unc.edu [152.2.1.138]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f25JA5x24655 for ; Mon, 5 Mar 2001 14:10:05 -0500 (EST) (envelope-from andrew_perrin@unc.edu) Received: from unc.edu (hpdp73.hpdp.unc.edu [152.2.226.136]) by smtpsrv1.isis.unc.edu (8.9.3/8.9.1) with ESMTP id OAA12308; Mon, 5 Mar 2001 14:05:39 -0500 (EST) Message-ID: <3AA3E775.AF1CFE8@unc.edu> Date: Mon, 05 Mar 2001 14:22:29 -0500 From: Andrew Perrin X-Mailer: Mozilla 4.6 [en] (WinNT; I) X-Accept-Language: en MIME-Version: 1.0 To: "Jeff S." CC: pgsql-sql@postgresql.org Subject: Re: How do I use text script containing SQL? References: <20010305185600.44574.qmail@web12702.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200103/121 X-Sequence-Number: 1773 psql \i filename.txt -Andy Perrin "Jeff S." wrote: > > I want to build my tables by placing all the sql > statements in a file. What is the correct way to use > this file with psql? > > Example: My text file has this in it: > > CREATE TABLE table1 ( > table1_id serial, > field1 char(5), > PRIMARY KEY (table1_id) > ); > > I want to be able to use the file to create my table. > I've tried psql -d databasename -e < filename.txt > but that doesn't work. > > __________________________________________________ > Do You Yahoo!? > Get email at your own domain with Yahoo! Mail. > http://personal.mail.yahoo.com/ > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org