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 2005 Forums
 SSIS and Import/Export (2005)
 Relocate CSV when finished processing

Author  Topic 

maramor
Starting Member

18 Posts

Posted - 2011-08-04 : 16:52:54
OK... first off hello and PLEASE HELP!! ooh and thank you :)

I am working with SQL 2005 SSIS and have a project that reads a csv into a table which is all fine and dandy. What I can not seem to figure out is that the File System Task after this keeps telling me "the file is open by another process". I believe that the SSIS package is holding the file open even though the dataflow has completed. Anyone have a idea around this?


Thanks,
Matt

maramor
Starting Member

18 Posts

Posted - 2011-08-04 : 16:59:17
Well I kinda proved that might be part a issue. I disabled the Data Flow and still have the issue.

I wrote a Script Task that reads the file and it passes when the Data Flow is disabled yet File System Task still fails with same error.
Public Sub Main()
'
Dim oFile As StreamReader
Dim sLine As String
Dim FileLocked As String
Dim FileName As String

FileLocked = "true"
FileName = Dts.Variables("C_File").Value.ToString()

While FileLocked = "true"
Try
oFile = File.OpenText(FileName)
sLine = oFile.ReadLine
FileLocked = "false"
oFile.Close()

Catch ex As Exception
FileLocked = "true"

Thread.Sleep(2000)
End Try

MsgBox(FileLocked)
End While
End Sub


I renamed the file just incase something else was writing to it, still get the same error.

Anyone?


Thanks,
Matt
Go to Top of Page

maramor
Starting Member

18 Posts

Posted - 2011-08-05 : 16:33:24
Good News is I solved my issue... Bad news is I don't know what exactly fixed the issue.




Thanks,
Matt
Go to Top of Page
   

- Advertisement -