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 2008 Forums
 SSIS and Import/Export (2008)
 file is used by another process

Author  Topic 

sarahmfr
Posting Yak Master

214 Posts

Posted - 2012-01-19 : 21:42:50
Hello,
I am receiving xml files continuously (every 2 seconds)file names are tick counts with xml extensions
I have a package that reads those files one by one and do some process and populates to temp table then run stored procedure.
I need the files to be sorted by tick count because the sequence is important so say 1.xml should be processed before 2.xml
I used a loop.
I tested the package by putting some of the files and put in a temporary folder (i got no problem)
but when I went live I get an error reading the file is being used by another user. It seems it is trying to read the file while it is being written although the folder already have 1000 files so the one being written now should be at the end of the list.
How to resolve that.
Thank you

sarah

yosiasz
Master Smack Fu Yak Hacker

1635 Posts

Posted - 2012-01-30 : 19:28:31
create two seperate folders one INPROCESS and another called READFORPROCESS. Have a .net script task that checks to see if file is in process, if so skip it. next time your ssis package runs it will pick it up if it is finished writing to disk.


If you don't have the passion to help people, you have no passion
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-30 : 19:39:57
you need to separate out read and write processes. As suggested before why not you log the file processing stages in a table. so any file thats currently in read stage will have one value for stage and written files will have another id value. You'll only pick those files for writing which have id values indicating end of read.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -