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
325 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
worked well - thanks.
0

Featured Post

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now