Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
336 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 1000 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 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
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 combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

885 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