Subject: Execute Task from ActiveX Script Task
Posted By: PorcupineRabbit Post Date: 12/30/2005 5:18:09 AM
Hello all,

I was wondering if there is a way to Execute an existing task (a Bulk Insert Task to be specific) through ActiveX task. My code is below, i get an error to the oBulkCopy. Execute line.The task already exists in the package.

Dim oPkg, oBulkTask, oBulkCopy, oEvents, oLog

Set oPkg = DTSGlobalVariables.Parent        
Set oBulkTask = oPkg.Tasks.Item("DTSTask_DTSBulkInsertTask_1")
            
Set oBulkCopy = oBulkTask.CustomTask
oBulkCopy.DataFile = strFilePath & oTable.Name & ".txt"
MsgBox oBulkCopy.DataFile
oBulkCopy.DestinationTableName = oTable.Name
MsgBox oBulkCopy.DestinationTableName

oBulkCopy.Execute  oPkg, oEvents, oLog, DTSTaskExecResult_Success
' Clear Up
Set oBulkCopy = Nothing
Set oBulkTask = Nothing
Set oPkg = Nothing

Thanks in advance and Happy New Year to everyone
Lagos Konstantinos

Reply By: David_the_DBA Reply Date: 1/10/2006 11:37:06 AM
You could instantiate a new package and instatiate and initialize all of the objects you would need to perform the bulk copy, or you could use VBScript to dynamically alter the precedence constraints so that when your ActiveX Script Task was done the next step would be the Bulk Copy.

David Lundell
Principal Consultant and Trainer
www.mutuallybeneficial.com

Go to topic 38516

Return to index page 399
Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392
Return to index page 391
Return to index page 390