command line issue - DOS commands following dbviscmd do not execute?
a
anonymous
started a topic
almost 10 years ago
[This topic is migrated from our old forums. The original author name has been removed]
In the DOS/SQL files below, I'm using a DOS rename command because I want the date in the result file name and I can't see a way to do that in the SQL. However, no DOS command I put after dbviscmd command will execute.
Thanks in advance for your help...
David
_DOS_
set today=%date:~4,2%-%date:~7,2%-%date:~10,4%
dbviscmd -connection "DBP1" -sqlfile "PrdCnt.sql"
ren "\\server\Production Counts\PrdCnt.xlsx" "PrdCnt %today%.xlsx"
_SQL_
@export on;
@export set filename="\\server\Production Counts\PrdCnt.xlsx" Format="XLS" ExcelFileFormat="xlsx";
SELECT
M_TYP, CRNT_STUS_CD, S_TYP,
Count(MFID) as S_CNT, SUM(PRCD_M1_CNT) as Init_M1_Cnt , SUM(INIT_M2_CNT) as Init_M2_CNT,
SUM(W3_CNT) as Prcd_M1_Cnt, SUM(PRCD_M22_CNT) as Prcd_M2_Cnt
FROM SMN
WHERE PRCG_YR = '2015'
GROUP BY CRNT_STUS_CD, M_TYP, S_TYP
with UR;
@export off;
Re: command line issue - DOS commands following dbviscmd do not execute?
Hi David,
Not sure I can help you with the DOS part, but you can get the current date in the filename for the export directly. Please see the Users Guide:
http://confluence.dbvis.com/display/UG92/Exporting+a+Schema#ExportingaSchema-UsingVariablesinFields
The User Guide describes this for the GUI-based export features, but the same is true for the @export command parameters, so this works:
@export set filename="\\server\Production Counts\PrdCnt_${dbvis-date}$.xlsx ...
Best Regards,
Hans
a
anonymous
said
almost 10 years ago
[This reply is migrated from our old forums. The original author name has been removed]
Re: command line issue - DOS commands following dbviscmd do not execute?
Hans,
Thanks for your reply.
I had already tried including the dbvis-date variable in the file name. after your response, I tried again with the same result. The Excel workbook is created successfully, but the file name is PrdCnt ${dbvis-date}.xlsx.
I suspect that it happens because the file name is in quotes. Unfortunately, there are imbedded spaces in the path that I cannot eliminate.
David
Roger Bjärevall
said
almost 10 years ago
[This reply is migrated from our old forums.]
Re: command line issue - DOS commands following dbviscmd do not execute?
David,
Have you also tried ${dbvis-date}$? Note that the default variable identifiers are ${...}$.
Regards
Roger
a
anonymous
said
almost 10 years ago
[This reply is migrated from our old forums. The original author name has been removed]
Re: command line issue - DOS commands following dbviscmd do not execute?
anonymous