Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

ActiveX Script to Script Task Expand / Collapse
Author
Message
Posted Wednesday, August 6, 2008 8:19 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, December 8, 2008 11:07 PM
Points: 2, 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

Post #547970
Posted Monday, August 25, 2008 10:29 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, November 6, 2012 11:21 AM
Points: 190, Visits: 50
Hey I got with the same problem, could you solve it? I need help too
Post #558268
Posted Monday, August 25, 2008 2:24 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 17, 2014 7:55 AM
Points: 2,805, Visits: 3,067
Me three !!!! I hate SSIS !
Post #558452
Posted Wednesday, August 27, 2008 8:56 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, December 8, 2008 11:07 PM
Points: 2, Visits: 44
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
Post #560091
Posted Thursday, August 28, 2008 7:10 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 17, 2014 7:55 AM
Points: 2,805, Visits: 3,067
Also I put down 'Main' in the Entry method and it seemed to work.
Post #560390
Posted Thursday, August 28, 2008 9:10 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, November 6, 2012 11:21 AM
Points: 190, 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 horibble!!!!! 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
Post #560571
Posted Thursday, August 28, 2008 7:47 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Sunday, April 27, 2014 6:26 AM
Points: 1,521, Visits: 3,036
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 :)
Post #560950
Posted Friday, August 29, 2008 9:39 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, November 6, 2012 11:21 AM
Points: 190, Visits: 50

Alas, now I have problem the DTSTaskExecResult_Failure
it doesnt work !!!
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....

Post #561318
Posted Friday, August 29, 2008 2:23 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 17, 2014 7:55 AM
Points: 2,805, Visits: 3,067
You should use

Dts.TaskResult = Dts.Results.Failure
Post #561515
Posted Friday, August 29, 2008 2:55 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, November 6, 2012 11:21 AM
Points: 190, 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 " :D
Post #561528
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse