I have been going through topics, but I cannot seem to find out why my code does not work.
What I am trying to do is run PSQL command line from Task Scheduler on a Windows machine. This PSQL should open a local file and execute the DROP TABLE commands in it.
The .sql file contains:
drop table public."ORDERS";
drop table public."CONSIGNMENTS";
The task scheduler is set like this:
And the argument in task scheduler tries the following code on one line:
psql -U postgres -h localhost -p 5433 << 'EOF' \c SoloSynch \i C:\Users\bckadmin\Desktop\drop_solosynch_tables.sql EOF
Problem is I do not get anything as a feedback. I just check in the DB and the tables are still present. Where am I going wrong?
EDIT: more codes I have tried and do not work. Nothing I seem to try from looking at other answers works...
psql -h localhost -U postgres -d SoloSynch -p 5433 -c 'drop table public."ASENDUNG";'
psql -h localhost -U postgres -d SoloSynch -p 5433 -c "drop table public."ASENDUNG";"
psql -h localhost -U postgres -d SoloSynch -p 5433 -c "drop table public."ASENDUNG";";
PGPASSWORD=passpsql psql -h localhost -U postgres -d SoloSynch -p 5433 -c "drop table public."ASENDUNG";"
PGPASSWORD=pass psql -h localhost -U postgres -p 5433 -d SoloSynch -c "drop table public."ASENDUNG";";
PGPASSWORD=pass psql -h localhost -U postgres -p 5433 -d SoloSynch -a -q -f C:\Users\bckadmin\Desktop\drop_solosynch_tables.sql
EDIT2: I do not know if this is relevant, but when I open pgAdmin 4 i enter password 2 times. Upon start and then for the DB. When I open manually psql i need only 1 time the password.