SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Move file system task errors out on the last file


Move file system task errors out on the last file

Author
Message
rockstar283
rockstar283
SSC-Enthusiastic
SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)

Group: General Forum Members
Points: 190 Visits: 669
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
rockstar283
SSC-Enthusiastic
SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)SSC-Enthusiastic (190 reputation)

Group: General Forum Members
Points: 190 Visits: 669
any ideas here guys..
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search