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


Need Solution for ActiveX script in SSIS


Need Solution for ActiveX script in SSIS

Author
Message
guptaopus
guptaopus
SSC-Enthusiastic
SSC-Enthusiastic (180 reputation)SSC-Enthusiastic (180 reputation)SSC-Enthusiastic (180 reputation)SSC-Enthusiastic (180 reputation)SSC-Enthusiastic (180 reputation)SSC-Enthusiastic (180 reputation)SSC-Enthusiastic (180 reputation)SSC-Enthusiastic (180 reputation)

Group: General Forum Members
Points: 180 Visits: 244
Hi,

I have activex script in my DTS package but i want to convert this into SSIS, I need to know which is the best solution in Script task,activex script task or using variables and control loops??? below given is my activex code please any body help me in finding solution

'**********************************************************************
' Visual Basic ActiveX Script
'************************************************************************
FUNCTION Main()
Dim oPkg, oTaskProperties
Dim iTaskCount, iPropertyCount, iMaxPackageVersion
Dim strTaskFileName

' SET OBJECT TO CURRENT PACKAGE
SET oPkg = DTSGlobalVariables.Parent

' LOOP THROUGH ALL PACKAGE TASKS TO DETERMINE WHICH ARE "Execute Package Task" OBJECTS
FOR iTaskCount = 1 to oPkg.Tasks.Count
' IF PACKAGE IS "Execute Package Task" SET GUID
IF isExecutePackageTask(oPkg.Tasks(iTaskCount).Properties) THEN
' GET THE FILE PATH AND NAME FROM THE TASK
strTaskFileName = oPkg.Tasks(iTaskCount).Properties.Item("FileName")

' GET PACKAGE GUID FROM THE FILE LOCATION
SET oInfoCollection = oPkg.GetSavedPackageInfos(strTaskFileName)
' SET THE MAX VERSION ID TO GET THE GUID
iMaxPackageVersion = oInfoCollection.Count

' SET THE GUID
oPkg.Tasks(iTaskCount).Properties.Item("PackageID").Value = oInfoCollection.Item(iMaxPackageVersion).PackageID
END IF
NEXT

' CLEAN UP
SET oPkg = NOTHING
SET oInfoCollection = NOTHING

Main = DTSTaskExecResult_Success
END FUNCTION

'**********************************************************************
' FUNCTION:
' isExecutePackageTask
' ARGUMENTS:
' oTaskProperties - Local Task Properies
' RETURNS:
' (boolean)
' PURPOSE:
' Determine if a task is an "Execute Package" Task
'************************************************************************
FUNCTION isExecutePackageTask(oTaskProperties)
' LOCAL VARIABLES DECLARATION
DIM iPropertyLoop, RTN

' INITIALIZE RETURN VARIABLE
RTN = FALSE

' LOOP THROUGH TASK'S PROPERTIES. IF "PackageID" EXISTS IN THE
' PROPERTIES, THEN THE TASK IS AN "Execute Package" TASK
FOR iPropertyLoop = 1 TO oTaskProperties.Count
IF oTaskProperties(iPropertyLoop).Name = "PackageID" THEN
RTN = TRUE
EXIT FOR
END IF
NEXT

' RETURN
isExecutePackageTask = RTN
END FUNCTION
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