SSIS Package(FTP TASK) how to get dynamic date files from ftp

  • Hi Experts,

    I am working on FTP TASK in SSIS Package. i have to get files from FTP that file names are like 20141110.txt. i want to download any particular date file from ftp. How to i set expression in Remote path? I need solution. Pls help to me.

    Thanks,

    Raj.

  • do you want to download all files files in the ftp location or just a specific date?

    if you want to get all the files in the format yyyymmdd.txt you can use:

    "????????"+".txt"

    if you wanted a specific date, for example only today's file you could use

    (dt_str,4,1252)DATEPART("yyyy", getdate())+(dt_str,4,1252)DATEPART( "mm", getdate() )+(dt_str,4,1252)DATEPART( "dd", getdate() )+".txt"

    you could replace the getdate() function with variable or a parameter if you wanted a different date.

    Bob
    -----------------------------------------------------------------------------
    How to post to get the best help[/url]

  • Hi,

    Its really helpful to me. I want to give specific date in that expression so that i have to create a variable and give date value, so that it will pull the specific date fies from FTP. am I right?

  • vnraaje (11/12/2014)


    Hi,

    Its really helpful to me. I want to give specific date in that expression so that i have to create a variable and give date value, so that it will pull the specific date fies from FTP. am I right?

    that is correct. create your variable with the data type of datetime and then use it in the expression like this:

    (dt_str,4,1252)DATEPART("yyyy", @[User::userdate])+(dt_str,4,1252)DATEPART( "mm", @[User::userdate] )+(dt_str,4,1252)DATEPART( "dd", @[User::userdate] )+".txt"

    should work.

    Bob
    -----------------------------------------------------------------------------
    How to post to get the best help[/url]

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply