• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 444
  • Last Modified:

DTS Run date output to file.

Is there a way to have the [DATE] function in DTSRun to only give me the month?

I need to have the [DATE] function in DTSRun to give me the the month only.
What I have is this:
DTSRun /S [SRVR] /E /N "_Common_FTPUtility" /A INIServer:8:S[SRVR] /A ReportName:8:="Exception_Report" /A SourceFileName:8:="Exception_Report.xls" /A DestFileName:8:="Exception_Report_[DATE].xls"

And this will give me: Exception_Report_20080125.xls

What I want is: Exception_Report_01.xls

thanks.
0
donnie91910
Asked:
donnie91910
  • 3
1 Solution
 
Anthony PerkinsCommented:
You will have to modify your DTS Package to add an ActiveX Script Task at the start of the workflow that will assign the value of the DestFileName Global Variable as in:

Function Main()
CONST DESTFILENAME = "Exception_Report_[DATE].xls"
Dim Today

Today = CStr(Year(Date())) & Right("0" & CStr(Month(Date())), 2) & Right("0" & CStr(Day(Date())), 2)
DTSGlobalVariables("DestFileName").Value = Replace(DESTFILENAME, "[DATE]", Today)

Main = DTSTaskExecResult_Success
End Function

0
 
donnie91910Author Commented:
I added the code as a vbscript task to the beginning of the dts package and the date on the file did not change.
0
 
Anthony PerkinsCommented:
Of course it did not.  Since you were passing in a global variable I assumed you were already doing that.  All that code does is assign the date to the global variable.

Since what you are now asking bares little resemblance to the original question, why don't you go ahead and describe the DTS package and which connection you are trying to change.
0
 
Anthony PerkinsCommented:
Also, since you only want Exception_Report_MM.xls,  my function should have been simplified as follows:

Function Main()
CONST DESTFILENAME = "Exception_Report_[DATE].xls"

DTSGlobalVariables("DestFileName").Value = Replace(DESTFILENAME, "[DATE]", Right("0" & CStr(Month(Date())), 2) )

Main = DTSTaskExecResult_Success
End Function
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now