SQLServer 2014 Visual Studio 2013/15 HTTP download Files with different URL's.

  • I have the need to download a .zip file from an given URL that changes daily (File Name Chance by the Date).
    Processing the file has already been accomplished in Date Flow Task.

    I set up a variable, File_Name_Minus1Day =
    "WS_OnPOINT_ZipWx_Daily" + ((DT_WSTR, 4) YEAR(DATEADD("day",-1,GETDATE()))
    +RIGHT("0" + (DT_WSTR, 2) DATEPART("MM", DATEADD("day", 1, GETDATE())),2)
    +RIGHT("0" + (DT_WSTR, 2) DATEPART("DD", DATEADD("day", -1, GETDATE())),2)) +
     "..zip"
    Which return the file dates minus 1 from GETDATE. This works fine but
    I need the attached to end of the URL. The weather data is compiled for me.

    http://weathersource.s3.amazonaws.com/delivery/CompanyName/WS....._Date.zip
    I will need to put the file on our network on a server of my picking.

    JJ

  • I'm not sure what exactly you're asking.   You've provided the algorithm that generates the file name, but then you state:

    "I need the attached to end of the URL"

    That's not quite a sentence, but I can't be sure how to CORRECTLY re-interpret it's meaning.   It would SEEM logical to just append the filename to the end of the URL, as often, a specification for a filename might use "_Date.zip" to specify that you are substituting the date portion for where the letters "Date" appear, but then, why are you asking for help if it's really that simple?

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • I am not trying to be vague. The values of the Date variable needs to be added to the end of the of the URL before I can connect to the WEB site for downloading the file.
    Is there a way to combine to variables in SSIS package? I am trying to use script task with an HHTP Connation of the URL without the file name, but not having any luck.
    The file name is: WS_OnPOINT_ZipWx_Daily20170223..zip
    URL is : http://weathersource.s3.amazonaws.com/delivery/Pabst/

    Need  the connection string to be put together like.
    http://weathersource.s3.amazonaws.com/delivery/Pabst//WS_OnPOINT_ZipWx_Daily20170223..zip

    Sorry for the confusion.

  • jjoseph 96114 - Friday, February 24, 2017 12:32 PM

    I am not trying to be vague. The values of the Date variable needs to be added to the end of the of the URL before I can connect to the WEB site for downloading the file.
    Is there a way to combine to variables in SSIS package? I am trying to use script task with an HHTP Connation of the URL without the file name, but not having any luck.
    The file name is: WS_OnPOINT_ZipWx_Daily20170223..zip
    URL is : http://weathersource.s3.amazonaws.com/delivery/Pabst/

    Need  the connection string to be put together like.
    http://weathersource.s3.amazonaws.com/delivery/Pabst//WS_OnPOINT_ZipWx_Daily20170223..zip

    Sorry for the confusion.

    I didn't think you were trying to be vague... it just ended up appearing that way.   Anyhow, your connection string can be an expression, in which you marry the two variables together.   So if the two variable names were pVarFileName and pVarURL, you could use:


    @[User::pVarURL] + @[User::pVarFileName]

    I'm assuming that the "/" that needs to be between the URL and the filename is already present in the URL.   The connection manager properties is where you can get to the expressions for the connection manager, and then from that dialog box, the left column allows you to choose the property you want an expression for, which in this case is Connection String.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • If you are connecting via a Script Task instead of a Connection Manager, then you just need to be sure both variables are Read accessible to your Script Task, and access the values of them in C# by:


        string ConnString = Dts.Variables("User::pVarURL").Value + Dts.Variables("User::pVarFileName");

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

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

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