Hello,
This is the first time I'm dealing with DB2 commands. I'm very new to this and I need some help.
I have a batch file (storedatainexcel.bat) looks something like this:
====================================================
@echo off
db2 CONNECT TO MYTABLE USER mytable USING password
set tstamp = 'db2 SELECT distinct current timestamp FROM MYTABLE.TABLE1'
echo "%tstamp%"
db2 export to c:\temp\myfile%tstamp%.csv OF WSF MESSAGES c:\temp\msgs.txt select * from MYTABLE.TABLE1
db2 COMMIT WORK
db2 CONNECT RESET
db2 TERMINATE
====================================================
I need to export some data to an excel spreadsheet and name the excel file with the current system timestamp attached to it.
I ran the following at the command prompt:
C:\Program Files\SQLLIB\bin>db2cmd storedatainexcel
And the "tstamp" variable is empty (echo "").
I would like to know how to:
1) get the timestamp and store it in a local variable?
2) use this local variable in the EXPORT statement?
Thanks in advance for helping.
This is the first time I'm dealing with DB2 commands. I'm very new to this and I need some help.
I have a batch file (storedatainexcel.bat) looks something like this:
====================================================
@echo off
db2 CONNECT TO MYTABLE USER mytable USING password
set tstamp = 'db2 SELECT distinct current timestamp FROM MYTABLE.TABLE1'
echo "%tstamp%"
db2 export to c:\temp\myfile%tstamp%.csv OF WSF MESSAGES c:\temp\msgs.txt select * from MYTABLE.TABLE1
db2 COMMIT WORK
db2 CONNECT RESET
db2 TERMINATE
====================================================
I need to export some data to an excel spreadsheet and name the excel file with the current system timestamp attached to it.
I ran the following at the command prompt:
C:\Program Files\SQLLIB\bin>db2cmd storedatainexcel
And the "tstamp" variable is empty (echo "").
I would like to know how to:
1) get the timestamp and store it in a local variable?
2) use this local variable in the EXPORT statement?
Thanks in advance for helping.