September 20, 2007 at 3:41 am
Hi,
I have a requirement where in i need to keep polling a folder for files and once the file arrives in a folder , i need to invoke ann SSIS package. I don't know how to invoke a package from code.
I am thinking, i'll make a windows service which will keep polling the folder and will invoke ssis package if some file comes in.
Somebody please help me out with the code.
Thanks,
Tarun
September 21, 2007 at 12:24 am
Hi Tarun,
check this link: http://msdn2.microsoft.com/en-us/library/ms136090.aspx
It worked fine for me. You can even change the configuration settings of your package (like the file you found) using the Configurations property of the package.
HTH
Tino
September 21, 2007 at 3:07 am
Tarun,
Creating a windows service in .Net is very straight forward. Simply use a FileSystemWatcher to monitor a particular directory and code similar to that at the link above to load and execute the package. You can pass the path to the file into a package variable as simply pkg.Variables("MyVariable").Value = pathToFile.
I would however recommend two things. Firstly try to obtain an exclusive lock on the file when it arrives as notification of the file's arrival will inevitably fire before it has been fully copied from the source.
Secondly, create an event listener class that inherits from DefaultEvents (an SSIS class) that allows you to override and catch the events/errors that you will probably want to log.
HTH.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply