Search Postgresql Archives

Re: newbie question: reading sql commands from script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks to all who answered this question!

From: Brent Wood <b.wood@xxxxxxxxxx>
To: basel novo <baselnovo@xxxxxxxxxxx>
CC: pgsql-general@xxxxxxxxxxxxxx
Subject: Re:  newbie question: reading sql commands from script
Date: Wed, 26 Oct 2005 10:36:34 +1300 (NZDT)



On Tue, 25 Oct 2005, basel novo wrote:

> What is the equivalent of the mysql 'source' command for reading sql
> commands from ascii script files?
>

I have not used mysql, so am not familiar with the source command, but to
have postgres run a set of sql statements/queries from a file you can:

psql <DB> -f "filename"



also, to run a single command from a script (or commandline)

psql <DB> -c "<sql command>"



Cheers,

  Brent Wood

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux