Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old December 30th, 2005, 06:18 AM
Registered User
Join Date: Dec 2005
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Execute Task from ActiveX Script Task

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

Old January 10th, 2006, 12:37 PM
Friend of Wrox
Join Date: Dec 2005
Posts: 146
Thanks: 0
Thanked 1 Time in 1 Post

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Deployment - Execute Package task carumuga SQL Server DTS 0 October 3rd, 2008 07:43 AM
How to add task in Scheduled Task programatically amitjoshipune C# 2 July 31st, 2008 05:42 AM
Using multiple SPs in one "Execute SQL Task" yukito SQL Server DTS 2 January 3rd, 2008 12:53 AM
execute xl macro in DTS 2000 activex script task ismailc SQL Server DTS 1 December 14th, 2007 10:14 AM
ActiveX Task riga SQL Server DTS 1 October 21st, 2004 03:34 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.