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
329 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
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 SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

785 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