Need Advice on Downloading a file from a website using SSIS

  • On a monthly basis, I need to download a zipped file from a government website. The 'new' file is not there on a given date (no real pattern), and the name of the file changes every month. If anyone has any examples on handling this, I'd really appreciate it.

    Because of the size of the file, I don't want to download the file unless it is a name that I haven't already recieved.

    There is no security (userid/password) required.

  • A Windows scheduled task can do this. It can run every so often (every day?) and download it if necessary.

  • What sort of task? Custom code, or a standard component?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • I'm not aware of any products that can do this so I would say custom code. Shouldn't be too difficult for a programmer as the scheduling business is taken care of by the Windows Scheduled Task system.

    Did your task have something to do with SSIS... since it's on this forum?

  • I was hoping for an SSIS job that could run once week. If the name of the file was 'new', it could download, unzip, and load into SQL.

  • Well what you could try is store the list of file names that you have already imported in a table. Then once a week your SSIS package can run, check to see if the file has been imported before and take it from there.

    You'd need an SSIS package with:

    ForEach Loop that contains a sql task that compares the file names to see if the file is new or not, the result can be stored in a variable. If the result confirms that you haven't imported the file before then you can move on to the next task.

    An execute sql task that runs xp_cmdshell to copy the file OR you can you can use an ftp task if you are ftp'ing the file OR you can use a file system task that can copy the file. (INSIDE ForEach Loop)

    Another execute sql task that runs BULK INSERT OR a data flow task that connects to the copied file and imports the data. (INSIDE ForEach Loop)

    Hope this helps... 🙂

    ----------------------------------------------------------------------------------------------
    Struggling to find the question?
    http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx

  • sgs (8/18/2009)


    I was hoping for an SSIS job that could run once week. If the name of the file was 'new', it could download, unzip, and load into SQL.

    I'm not aware of an SSIS job as such. You would need to have some scheduling system run the SSIS package, such as the SQL Server Agent or a similar system.

Viewing 7 posts - 1 through 6 (of 6 total)

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