dbTalk Databases Forums  

ftp task

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss ftp task in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
qjlee
 
Posts: n/a

Default ftp task - 12-05-2006 , 10:21 PM






Hi, I am setting up a dts package. One of the the step is to grab a file
from a ftp site, the file is name as ABCMMDD, the MMDD being yesterday's
date. How I can configure it.

Thanks,

Reply With Quote
  #2  
Old   
TM
 
Posts: n/a

Default Re: ftp task - 12-06-2006 , 10:51 AM






yes, you need ActiveX task. Make your life easier and grab an FTP Task and
put in on the design surface so when you add a Dynamic Properties Task you
can see the FTP tasks properties and Set the value to the global variable
you define.

Here's the VBScript I would use, where gvFilename is the Global Variable you
create.

DTSGlobalVariable("gvFilename").Value = "filename" & month(now) & day(now)

"Todd C" <ToddC (AT) discussions (DOT) microsoft.com> wrote

Quote:
I know how I would do it in SSIS, and hopefully the same general process
would apply in DTS:

Set up a global variable that will hold the file name value.
Create an ActiveX script that will figure out the MM and DD part of
yesterday's date and assign the variable value to a concatenation of all
the
elements needed.

I have done this very thing in SSIS. Sorry I cannot give you details on
how
to do it in DTS.

HTH
--
Todd Chittenden


"qjlee" wrote:

Hi, I am setting up a dts package. One of the the step is to grab a file
from a ftp site, the file is name as ABCMMDD, the MMDD being yesterday's
date. How I can configure it.

Thanks,



Reply With Quote
  #3  
Old   
TM
 
Posts: n/a

Default Re: ftp task - 12-06-2006 , 11:53 AM



I think that should work fine in an ActiveX task actually.

"Todd C" <ToddC (AT) discussions (DOT) microsoft.com> wrote

Quote:
Here is a script excerpt that sets a filename with YESTERDAY'S datestamp:

**************** CODE *****************

Dim Today As System.DateTime
Dim Yesterday As System.DateTime
Dim t As String
Dim yy As String
Dim mm As String
Dim dd As String

Today = System.DateTime.Now
Yesterday = Today.AddDays(-1)

yy = Right(CStr(Year(Yesterday)), 2)
mm = CStr(Month(Yesterday))
If Day(Yesterday) < 10 Then
dd = "0" + CStr(Day(Yesterday))
Else
dd = CStr(Day(Yesterday))
End If
'dd = "24"

t = "< My File Path and name >" + yy + mm + dd

******************* END *****************

Now, I'm sure that some VB.NET guru out there will tell me there is a
better
way to do this, but it works for me. You may have trouble using exactly as
is
in DTS. Like I said, I'm not familiar with Scripting in DTS.

Good luck!




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.