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)
 Rename File in SSIS

Author  Topic 

Mobyforce1
Starting Member

1 Post

Posted - 2010-11-04 : 11:23:05
I receive a file daily that i need to process through my databases. I have tried using a File System Task and Script task, but can't get it right. I can get it to work with static file names, but the files I receive are never the same.

I am having a hard time figuring out how to do it with variables. I am just trying to name it to a standard name so i can run my packages against it.

Source File Name = FileName_YYYYMMDDHHMMSS.txt

Trying to name it to 'FileName.txt'


Any ideas would be greatly appreciated.

Thank you all
Corey

update. I thought i could add an example of my script. I know it doesn't like the wildcard, but I cant figure out what I should try.
Public Class ScriptMain

Public Sub Main()
Dim FileName As String
Dim NewFileName As String

FileName = "**********\Data\Reporting\ProductionExaminee*.txt"

NewFileName = "**********\Data\Reporting\ExamineeCurrent.txt"

If System.IO.File.Exists(FileName) = True Then
System.IO.File.Move(FileName, NewFileName)
End If

Dts.TaskResult = Dts.Results.Success
End Sub

End Class

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-11-06 : 10:39:33
Define an ssis variable, set the variable value, lock and read the variable in the script set a variable with the result. Set the filename with the path concatenated with that variable.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -