Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Move file system task errors out on the last file Expand / Collapse
Author
Message
Posted Friday, April 4, 2014 4:29 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 3:52 PM
Points: 111, Visits: 502
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!!
Post #1558676
Posted Monday, April 7, 2014 11:31 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Today @ 3:52 PM
Points: 111, Visits: 502
any ideas here guys..
Post #1559203
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse