I currently try to modify an sql script from a colleague as my first steps into SQL.
Basically 2 queries and output into 2 files with a static name work as intended from one sql-script input file.
However, I would like to add the current date as YYYYMMDD into the filename e.g. CONCAT(prefix, date, suffix). However, this is where I hit the wall one way or the other and end up having my files named "CONCAT", errors or output into shell.
In the end I want:
query1name20222403.txt
query2name20222403.txt
What I have so far:
set echo off ;
set list on ;
set heading on ;
out "query1name.txt";
select alotofvalues as alotofnames
from table a
left join othertable o on a.something = o.somethingelse
where(some statemens)
order by o.someval;
out "query2name.txt";
select alotofvalues as alotofnames
from anothertable a
left join anotherothertable o on a.something = o.somethingelse
where(some statemens)
order by o.someval;
out;
I hope that someone here can guide me into the right direction on how to integrate the date into my outfile names. I already got current_date+0 to display the YYYYMMDD.