Solved

creating a file and then copying it: how to break the dependency between the 2 steps in SSIS

Posted on 2011-03-07
4
330 Views
Last Modified: 2013-11-10
Oledb source editor pumps data into a flat file destination editor. after this data flow task, there is a file system task editor that copies this file into another OS drive location. This step is failing saying "The process cannot access the File ... because it is being used by another process."

how can we make sure that the first data task does not keep a hold on the file so that the next step does not fail? Is this plausible?

thanks
0
Comment
Question by:anushahanna
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
Reza Rad earned 250 total points
ID: 35065760
you can fill data into file with SCRIPT COMPONENT AS DESTINATION.
then in the script component PostExecute method you can Flush and Close the streamwriter.

and you will never have problem on other tasks after this step.

for working with files in script component, you need to use System.IO.StreamWriter.
you should instanciate a new streamwriter at PreExecute method of script component
and fill values in flat file with streamWriter.WriteLine() in the ProcessInputRow

and finally close the stream writer in PostExecute method with
streamwriter.Flush();
streamwriter.Close();
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35069694
thanks for the alternative idea-

the idea i have mentioned above - do you anticipate this issue always? i did not seem to happen in SSIS 2005, but SSIS 2008 is perhaps more picky?
0
 
LVL 16

Assisted Solution

by:vdr1620
vdr1620 earned 250 total points
ID: 35071302
Well, i use SSIS 2008 to do similar tasks, i also use Excel file in may situations but never saw this problem with csv or Txt files...

I would say if you are unable to resolve the issue.. try to run these tasks manually one by one and see if the problem still persists..iF yes then there is Something wrong

Also, i believe this is more of a permissions issue on the Folder and not with SSIS. make sure that the user has Read write Permissions to the folder
0
 
LVL 6

Author Comment

by:anushahanna
ID: 35141589
worked well - thanks.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question