How to execute postgres' sql queries from batch file?

后端 未结 7 1628
小蘑菇
小蘑菇 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条回答
  •  Happy的楠姐
    2021-02-08 15:10

    If you are trying the shell script

    psql postgresql://$username:$password@$host/$database < /app/sql_script/script.sql

提交回复
热议问题