Just put it on the command line after psql :
psql example.sql
psql will take the file and run each line on the server.
If the server is not running on your computer, you need to specify the host name on the computer and the username to log into the server with:
psql -h server.postgres.com -U username example.sql
To send multiple files, just list them all:
psql example1.sql example2.sql example3.sql
charan
source share