August 6, 2008 at 8:19 pm
I am just a beginner in SSIS and having a problems to convert this ActiveX script task code to Script Task.I just know that ActiveX script task will be deprecated in SSIS 2008.
Could anyone help me?
Function Main()
Dim strFileName, strFilePath, strDateTime, fso,strArchivePath
strFilePath = DTSGlobalVariables("File_Directory").Value
If Right(strFilePath, 1) <> "\" Then
strFilePath = strFilePath & "\"
End If
strDateTime = Right("0" & Month(Date),2) & Right("0" & Day(dateadd("d",-1,Date) ),2) & Year(Date)
' First file
strFileName=DTSGlobalVariables("First_File_Name").Value
'Backup First file
strArchivePath = DTSGlobalVariables("Archive_Directory").Value
If Right(strArchivePath, 1) <> "\" Then
strArchivePath = strFilePath & "\"
End If
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile strFileName, strArchivePath & "Overpack_" & strDateTime & ".txt", True
' Second file
strFileName=DTSGlobalVariables("Second_File_Name").Value
'Backup Second file
fso.CopyFile strFileName, strArchivePath & "Product_" & strDateTime & ".txt", True
Main = DTSTaskExecResult_Success
End Function
This code is actually from DTS migration to SSIS. After migration, it become ActiveX script task.i need to convert this task to script task.
help me please....(-_-)....
thanks
August 25, 2008 at 10:29 am
Hey I got with the same problem, could you solve it? I need help too
:w00t:
August 25, 2008 at 2:24 pm
Me three !!!! I hate SSIS !:crazy::angry:
August 27, 2008 at 8:56 pm
not sure whether this could help or not. But it works for me.Good Luck:D
Public Sub Main()
Dim strFileName, strFilePath, strDateTime, strArchivePath As String
strFilePath = "\\pg\FlexDirectory\FTP"
If Right(strFilePath, 1) <> "\" Then
strFilePath = strFilePath & "\"
End If
strDateTime = Right("0" & Month(Now.Date), 2) & Right("0" & Day(DateAdd("d", -1, Now.Date)), 2) & (Year(Now.Date))
'First File
strFileName = "\\pg\FlexDirectory\FTP\Bax\first.txt"
'Backup first file
strArchivePath = "C:\FTP\Archive\Bax"
If Right(strArchivePath, 1) <> "\" Then
strArchivePath = strArchivePath & "\"
End If
FileSystem.FileCopy(strFileName, strArchivePath & "First_" & strDateTime & ".txt")
' Second file
strFileName = "\\pg\FlexDirectory\FTP\Bax\second.txt"
'Backup Second file
FileSystem.FileCopy(strFileName, strArchivePath & "Second_" & strDateTime & ".txt")
Dts.TaskResult = Dts.Results.Success
End Sub
August 28, 2008 at 7:10 am
Also I put down 'Main' in the Entry method and it seemed to work.
August 28, 2008 at 9:10 am
Yes I could solved that and other detail , I needed change the source of a text file , because the dynamic properties died, well I could solved that changing the property "Expression" of the source flat file
But what a horibble:w00t:!!!!! the mapping of my transformation died !!!!
OH nooooo and it is a big file with fixed width
Fog!!!
PD : Excuse my bad english
Greetings from Chile
August 28, 2008 at 7:47 pm
My preference in a case like this would be to use SSIS File tasks to copy the files. I'd encourage you to remember that a lot of functions now found in SSIS weren't available in DTS, so we had to build them with scripts or whatever. This example given in the original post looks like a classic case.
You'll want to set up your file tasks to do the Copy File using expressions that contain the source and target file names.
And don't worry about your English. It's much better than my Spanish 🙂
August 29, 2008 at 9:39 am
Alas, now I have problem the DTSTaskExecResult_Failure
it doesnt work !!! :w00t::crazy:
exists another way to handle the errors??? thank you for your mercy
what hell the bill gate team dont do avaible with dts I will kill them....
August 29, 2008 at 2:23 pm
You should use
Dts.TaskResult = Dts.Results.Failure
August 29, 2008 at 2:55 pm
Yeah thank you, I could solved , I had to rewrite my ActiveX Task to
Script Task in VB.net ,as Houdini said
"it is easy if you know how to do it " 😀
August 29, 2008 at 2:59 pm
Hector,
I'm curious. Why do you want to use a script to copy files rather than use the built-in file tasks that come with SSIS?
August 29, 2008 at 3:11 pm
I am using a task tranformation but it is the path that I must to validate , so if exists some file or not , in my Dts I was doing that with an ActiveX
so one time validated , I will pass the path with a dynamic properties to the transformation
Well now in my ssis , I replaced the dynamic properties with a Expression user variable and the ActiveX was changed by a Script Task with VB.NET
Thank you for their helpings
April 16, 2013 at 12:01 pm
why don't you simply use "File System task" task in control flow and copy or move or renames
April 17, 2013 at 4:39 am
azhuravel (4/16/2013)
why don't you simply use "File System task" task in control flow and copy or move or renames
You are responding to a post which is nearly five years old.
The absence of evidence is not evidence of absence.
Martin Rees
You can lead a horse to water, but a pencil must be lead.
Stan Laurel
Viewing 14 posts - 1 through 13 (of 13 total)
You must be logged in to reply to this topic. Login to reply