How to execute postgres' sql queries from batch file?

后端 未结 7 1528
小蘑菇
小蘑菇 2021-02-08 14:36

I need to execute SQL from batch file. I am executing following to connect to Postgres and select data from table

C:/pgsql/bin/psql -h %DB_HOST% -p 5432 -U %DB_         


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-08 15:20

    Kindly refer to the documentation

    1] if you are passing the file with the sql use -f or --file parameter
    2] if you are passing individual command use -c or --command parameter

提交回复
热议问题