I need to execute SQL from a batch file. I follow these steps to connect to Postgres and select data from a table
C:/pgsql/bin/psql -h %DB_HOST% -p 5432 -U %DB_USER% -d %DB_NAME% select * from test;
I can connect to the database, however I get an error
'select' is not recognized as an internal or external command, operating program, or batch file.
Has anyone encountered such a problem?
This is one of the requests I'm trying to make, something like this works in a shell script (please ignore the syntax error in the request, if any)
copy testdata (col1,col2,col3) from '%filepath%/%csv_file%' with csv;
source share