How to execute postgres' sql queries from batch file?

后端 未结 7 1527
小蘑菇
小蘑菇 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:36

    You cannot put the query on separate line, batch interpreter will assume it's another command instead of a query for psql. I believe you will need to quote it as well.

    0 讨论(0)
提交回复
热议问题