January 16, 2008 at 1:32 pm
I was sure this would ahve been simple but I can't seem to get this to work. I just want to rename a csv file to the date in a dd-mm-yyyy format. I created a script task to do so and I'm not having any luck.
Hy code is here
Public Sub Main()
Try
Dim td As String = Now.Date.ToString()
File.Move("E:\filesewfile.csv", "E:\files\" & td & ".csv")
Catch ex As Exception
Dts.Events.FireError(1, "File error", "", "", 0)
End Try
Dts.TaskResult = Dts.Results.Success
End Sub
My task fails.
Is there no way for me to step through this code to figure out where it is going wrong? I have tried dts variables too. They work, but I don't know how to get the date in there.
January 16, 2008 at 1:39 pm
Try the FileSystem task. I use it in several SSIS projects.
January 16, 2008 at 2:03 pm
Apprently string concats are + and not &
I thought this is supposed to be VB.NET?
January 16, 2008 at 2:11 pm
I just looked at one of my SSIS packages that has a Script Task, and I am using the & to concatenate strings.
This is the code in my script.
Public Class ScriptMain
Public Sub Main()
Dim FileDate As String
FileDate = Format(Dts.Variables("StartTime").Value, "yyyyMMdd")
Dts.Variables("DestinationFileLocation").Value = CStr(Dts.Variables("DestinationFileLocation").Value) & "\" & FileDate
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
January 18, 2008 at 1:56 am
Are you sure that this is the correct path? AFAIK "E:\" means E on the server not the client.
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy