Take a little bit of work, but not too difficult depending on the date format:
Put this in an ActiveX Task as your first step (or at least before your
import):
Function Main()
Dim oConn, sFilename
Dim Sequence
Dim Minutes
Dim CurrentDate
CurrentDate = DATEADD("h", -2, Now())
'We were working with a time from a server in PST. We're in CST.
'You could probably just use Now()
' Sequence = Hour(CurrentDate)
' If Sequence < 10 Then Sequence = "0" & Sequence
' Minutes = (Minute(CurrentDate) \ 15) * 15
' If Minutes < 10 then Minutes = "0" & Minutes
' sFilename = "DFSPP20030608hhmm.tab"
' Filename format - VEyyyymmddhh.txt
sFilename = "VE" & Right(Year(CurrentDate), 4)
If Month(CurrentDate) < 10 Then sFilename = sFilename & "0" & _
Month(CurrentDate) Else sFilename = sFilename & Month(CurrentDate)
If Day(CurrentDate) < 10 Then sFilename = sFilename & _
"0" & Day(CurrentDate) & ".txt" Else sFilename = sFilename & _
Day(CurrentDate) & ".txt"
DTSGlobalVariables("FileName").value = "'" & sFileName & "';'';'';"
sFilename = "\\servername\sharename\" & _
sFilename
'msgbox sFilename
Set oConn = DTSGlobalVariables.Parent.Connections("ImportFile")
oConn.DataSource = sFilename
Set oConn = Nothing
Main = DTSTaskExecResult_Success
End Function
[quoted text, click to view] "Rodney Pacheco P" <pachecopr@sugeval.fi.cr> wrote:
>
> Hello, I' m Rodney and new using DTS and want to create a DTS, it must
> import everyday to a table a text file, this file is called "VE" + date of
> the day.txt. I know how to load it to the database, but I need to use
> vbscript to know which is the name of this file everyday, and change it
> automatically.
>
> Somebody can help me?
>
> Thanks a lot!!!
>
>