Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 SSIS and Import/Export (2012)
 Move file system task errors out on the last file

Author  Topic 

rockstar283
Yak Posting Veteran

96 Posts

Posted - 2014-04-04 : 18:29:32
I have been developing a package which moves excel files from staging folder to archive folder, once those files are used by an excel connection manager.

I have a foreach loop container which goes through all the files of the staging folder. In the foreach loop container, I have a script task which has following code only:

Dts.Connections["Excel Connection Manager 1"].ReleaseConnection(null);

//Excel Connection Manager 1 is the connection which uses the excel files. My logic behind this is to release the locks on the files if any. I am not sure if NULL is working though

Next is an Execute sql task which only has 'WAITFOR DELAY '00:00:01' in it. I googled a lot and this was suggested at many places..

Now I have the actual move file task which moves the files from staging folder to the archive folder.

So, the process works well for all the files except the last one. The last file still remains locked by the excel connection manager and that is why the move file task fails.

I also scripted the move file using the example given here : LINK

That doesn't fail the package, but doesn't move the last file as well.

I also tried 'Dts.Connections["Excel Connection Manager 1"].Dispose();' instead of releaseconnection, but thats not helping either

Can anyone please help me out here..

Thanks in advance!!

rockstar283
Yak Posting Veteran

96 Posts

Posted - 2014-04-07 : 13:31:08
any ideas here guys..
Go to Top of Page
   

- Advertisement -