pg-cmd - PostgreSQL interactive and batch query command-line tool »

Download pg-cmd Free Trial »

Run sql scripts from command or file

Run scripts from command

example:

pg-cmd > select * from media_messages;


Run scripts from file

In interactive mode:

pg-cmd>source #sqlfile#;

example:

pg-cmd > source e:\temp\tables\insert_data.sql


In batch mode:

pg-cmd dsn="username:password@host:port/dbname" task=source sqlfile=#sqlfile#

example:

pg-cmd dsn="pan:withdata@192.168.0.102::5432/test" task=source sqlfile=e:\temp\tables\insert_data.sql