Extract data into a txt with given path and zip it and delete the text file.

  • I have to query table1 which results in a bunch of rows with two columns, one is stateid and the other is a path on my server(\\xyz\abc\pqr), each stateid has a different path. now for every state id

    there are a bunch of unitid in table2. I will need to create a package which does the following

    1.For Each Stateid

    SELECT * from Table3 where table3.unitid IN (select unitid from Table2 where Table2.Stateid = "") and write it into a txt file (create the txt file on the fly),the path of the txt file will be the path got from table1 for that stateid.

    So it will be like

    for Stateid = 1 ,path = \\folder1\Folder2

    SELECT * from Table3 where table3.unitid IN (select unitid from Table2 where Table2.Stateid = "") and write it into a txt file,the path of the txt file will be path above(\\folder1\folder2).

    zip the txt file in the same folder and delete the txt file.

    for Stateid = 2 ,path = \\folder3\Folder4

    SELECT * from Table3 where table3.unitid IN (select unitid from Table2 where Table2.Stateid = "") and write it into a txt file,the path of the txt file will be path above(\\folder3\Folder4)

    zip the txt file in the same folder and delete the txt file.

    Thanks in advance...

  • Well first you need a zip component. You can try:

    http://taskunzip.codeplex.com/

    You can also accomplish it with SharpZipLib, 7zSharp, or SevenZipSharp libraries on CodePlex. You would probably need to add the zip lib to the GAC either way. With the first component you can do it right there. In the others you would need to add a script component.

    To delete the file you could likely use a MOVE option in the libraries. If not then a file system task can delete the file. You can build the command and use expressions to set the task correctly.

    CEWII

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

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