Re: CSVWRITE - Title of CSV File to include system date?

58 views
Skip to first unread message

Brian

unread,
Sep 27, 2012, 8:46:14 PM9/27/12
to h2-da...@googlegroups.com
call csvwrite('c:/temp/fileprefix-' || current_date(),'select * from data_push');

On Thursday, September 27, 2012 6:30:03 AM UTC-7, sc8132 wrote:
Hi,

I have a call csvwrite script for my database. How can I include the system date in the title of the csv file?

Here is the current working script:
CALL CSVWRITE('C:\TEMP\exportdata.csv','SELECT "DATA_PUSH".* FROM "PUBLIC"."DATA_PUSH" "DATA_PUSH"','fieldDelimiter= writeColumnHeader=false');

Thanks!
Sherry

sc8132

unread,
Sep 28, 2012, 1:41:48 PM9/28/12
to h2-da...@googlegroups.com
you're awesome.. thank you!!!

sc8132

unread,
Sep 28, 2012, 1:46:58 PM9/28/12
to h2-da...@googlegroups.com
Sorry, how do i format the date and time so its like this

092820121046

to mmddyyyhhhh?

Brian

unread,
Sep 29, 2012, 2:50:21 AM9/29/12
to h2-da...@googlegroups.com
CALL FORMATDATETIME(CURRENT_TIMESTAMP(), 'MdyyyyHHmm', 'en', 'GMT')
Per:
http://www.h2database.com/html/functions.html?highlight=CURRENT_DATE&search=current_#formatdatetime
http://docs.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html

If you're keeping the files however, sometimes it's best to use yyyyMdHHmm so they appear chronologically in directory/file listings etc...
Reply all
Reply to author
Forward
0 new messages