postgresql copy comand with date in filename
1
vote
2
answers
4377
views
I have a query and want the output in a .csv file with today's date and time in the name (I am using PostgreSQL v12).
COPY
(SELECT * FROM mytable)
TO 'C:\Users\me\mylocation\filename_date_time.csv' CSV HEADER
where date_time is
YYYY-MM-DD-h_m_s
(or similar)
I have seen some solutions to this using bash. For various reasons I am on a Windows machine with no bash.
I would like to do this using psql please.
Asked by we need a Mat. Stat.
(111 rep)
Jan 19, 2021, 11:54 PM
Last activity: Feb 23, 2024, 07:04 AM
Last activity: Feb 23, 2024, 07:04 AM