I'm running a .dtsx file using a load bat and I'm trying to make some adjustments:
To generate the name of the error log file, the following code is used:
ECHO ON
:: DATA_HORA
set hour=%time:~0,2%
if "%hour:~0,1%" == " " set hour=0%hour:~1,1%
set min=%time:~3,2%
if "%min:~0,1%" == " " set min=0%min:~1,1%
set secs=%time:~6,2%
if "%secs:~0,1%" == " " set secs=0%secs:~1,1%
set year=%date:~-4%
set month=%date:~3,2%
if "%month:~0,1%" == " " set month=0%month:~1,1%
set day=%date:~0,2%
if "%day:~0,1%" == " " set day=0%day:~1,1%
SET data=%year%%month%%day%_%hour%%min%%secs%
SET outputfile=%VAR_LOGS_DIR%CARGA_SSIS_%data%.log
"%VAR_DTSEXEC_DIR%" /F "%VAR_PACKAGE_DIR%\NOME_PACOTE.dtsx" /CONNECTION %CN_S_TRA% /CONNECTION %CN_T_STG% /REPORTING E >> %outputfile%
IF ERRORLEVEL 1 GOTO END
The generated log gets the correct name: CARGA_SSIS_20170321_103029
, but looking at this code that generates the name indicates that it has better ways to mount this ...
Mount a log to the file that says the name of the .dtsx package that was run:
I need it to report in the log which the name of the .dtsx package that was run to result in success / error and that it removed some attributes that are not useful, an example of how I wanted it to be is: / p>
FROM THE ORIGINAL:
Microsoft (R) SQL Server Execute Package Utility
Version 11.0.3487.0 for 32-bit
Copyright (C) Microsoft Corporation. All rights reserved.
Started: 10:30:29
DTExec: The package execution returned DTSER_SUCCESS (0).
Started: 10:30:29
Finished: 10:31:47
Elapsed: 77.75 seconds
Started: 10:31:50
DTExec: The package execution returned DTSER_SUCCESS (0).
Started: 10:31:50
Finished: 10:32:47
Elapsed: 77.75 seconds
Started: 10:32:47
DTExec: The package execution returned DTSER_SUCCESS (0).
Started: 10:32:47
Finished: 10:34:43
Elapsed: 77.75 seconds
TO LOG IN WITH THE NAME OF .DTSX PACKAGES EXECUTED
Microsoft (R) SQL Server Execute Package Utility
Version 11.0.3487.0 for 32-bit
Copyright (C) Microsoft Corporation. All rights reserved.
Name: NOME_DO_PACOTE1.DTSX
Started: 10:30:29
DTExec: The package execution returned DTSER_SUCCESS (0).
Started: 10:30:29
Finished: 10:31:47
Elapsed: 77.75 seconds
Name: NOME_DO_PACOTE2.DTSX
Started: 10:31:50
DTExec: The package execution returned DTSER_SUCCESS (0).
Started: 10:31:50
Finished: 10:32:47
Elapsed: 77.75 seconds
Name: NOME_DO_PACOTE3.DTSX
Started: 10:32:47
DTExec: The package execution returned DTSER_SUCCESS (0).
Started: 10:32:47
Finished: 10:34:43
Elapsed: 77.75 seconds