SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


ActiveX Script to Script Task


ActiveX Script to Script Task

Author
Message
oliver_sas
oliver_sas
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 44
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
Hector Angello Silva Carmona
Hector Angello Silva Carmona
SSChasing Mays
SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)

Group: General Forum Members
Points: 656 Visits: 50
Hey I got with the same problem, could you solve it? I need help too
w00t
Loner
Loner
SSCertifiable
SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)

Group: General Forum Members
Points: 6362 Visits: 3364
Me three !!!! I hate SSIS !CrazyAngry
oliver_sas
oliver_sas
Grasshopper
Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)Grasshopper (18 reputation)

Group: General Forum Members
Points: 18 Visits: 44
not sure whether this could help or not. But it works for me.Good LuckBigGrin


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

Loner
Loner
SSCertifiable
SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)

Group: General Forum Members
Points: 6362 Visits: 3364
Also I put down 'Main' in the Entry method and it seemed to work.
Hector Angello Silva Carmona
Hector Angello Silva Carmona
SSChasing Mays
SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)

Group: General Forum Members
Points: 656 Visits: 50
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 horibblew00t!!!!! 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
john.arnott
john.arnott
Hall of Fame
Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)Hall of Fame (3.6K reputation)

Group: General Forum Members
Points: 3566 Visits: 3059
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 Smile
Hector Angello Silva Carmona
Hector Angello Silva Carmona
SSChasing Mays
SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)

Group: General Forum Members
Points: 656 Visits: 50
Alas, now I have problem the DTSTaskExecResult_Failure
it doesnt work !!! w00tCrazy
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....
Loner
Loner
SSCertifiable
SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)SSCertifiable (6.4K reputation)

Group: General Forum Members
Points: 6362 Visits: 3364
You should use

Dts.TaskResult = Dts.Results.Failure
Hector Angello Silva Carmona
Hector Angello Silva Carmona
SSChasing Mays
SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)SSChasing Mays (656 reputation)

Group: General Forum Members
Points: 656 Visits: 50
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 " BigGrin
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search