dbTalk Databases Forums  

Need to execute existing ExecuteSQLTask within ActiveX Script code

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Need to execute existing ExecuteSQLTask within ActiveX Script code in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jamie Carper
 
Posts: n/a

Default Need to execute existing ExecuteSQLTask within ActiveX Script code - 12-10-2004 , 05:05 PM






The following link to MSDN documents the parameters required to use the
Execute method of the ExecuteSQLTask object:

http://msdn.microsoft.com/library/de...ethai_4p0k.asp

The doc speaks of a reference to Package2 and Package2 Events as well as
PackageLog.

Please will someone illustrate how to call this method with it's required
parameters.

I realize it is not standard to call a DTS Task object dynamically, but I
have no choice as I need to call the process within a recursive function in
an ActiveX Script object.

I cannot find any examples on MSDN nor any other source I have since searched.

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Need to execute existing ExecuteSQLTask within ActiveX Script code - 12-12-2004 , 03:18 PM






In message <364CF51F-D1A9-49CF-9418-6AEFFF7EAF98 (AT) microsoft (DOT) com>, Jamie
Carper <JamieCarper (AT) discussions (DOT) microsoft.com> writes
Quote:
The following link to MSDN documents the parameters required to use the
Execute method of the ExecuteSQLTask object:

http://msdn.microsoft.com/library/de...-us/dtsprog/dt
spmethai_4p0k.asp

The doc speaks of a reference to Package2 and Package2 Events as well as
PackageLog.

Please will someone illustrate how to call this method with it's required
parameters.

I realize it is not standard to call a DTS Task object dynamically, but I
have no choice as I need to call the process within a recursive function in
an ActiveX Script object.

I cannot find any examples on MSDN nor any other source I have since searched.
I think you've solved your problem in another thread, but for
completeness here is a solution from an old post. This sample adds a new
ActiveX Script Task and executes it, but you could just reference an
existing task. I really do *not* recommend this approach though-

Option Explicit

Function Main()

Dim oPkg

Set oPkg = DTSGlobalVariables.Parent

Dim oCustomTask ' DTS.ActiveScriptTask

Dim oTask
Set oTask = oPkg.Tasks.New("DTSActiveScriptTask")
oTask.Name = "DTSTask_DTSActiveScriptTask_X"
Set oCustomTask = oTask.CustomTask
oCustomTask.Name = "DTSTask_DTSActiveScriptTask_X"
oCustomTask.Description = "ActiveX Script Task X"
oCustomTask.ActiveXScript = "Option Explicit" & vbCrLf & _
"Function Main()" & vbCrLf & _
" MsgBox(""ActiveX Script Task X"")" & vbCrLf & _
" Main = DTSTaskExecResult_Success" & vbCrLf & _
"End Function"
oCustomTask.FunctionName = "Main"
oCustomTask.ScriptLanguage = "VBScript"
oCustomTask.AddGlobalVariables = True

oTask.Execute oPkg, Nothing, Nothing, CLng(0)

Set oCustomTask = Nothing
Set oTask = Nothing
Set oPkg = Nothing



Main = DTSTaskExecResult_Success
End Function

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
  #3  
Old   
Jamie Carper
 
Posts: n/a

Default Re: Need to execute existing ExecuteSQLTask within ActiveX Script - 12-13-2004 , 08:21 AM



Hi Darren,

This is the only line I needed to see. Thanks.

Quote:
oTask.Execute oPkg, Nothing, Nothing, CLng(0)

And yes, I agree it is best to reference an existing Task. Which is exactly
what I am trying to do. I just needed to know how to execute that task
without a workflow.

I will give the above syntax a try.

Jamie


Reply With Quote
  #4  
Old   
Darren Green
 
Posts: n/a

Default Re: Need to execute existing ExecuteSQLTask within ActiveX Script - 12-13-2004 , 01:18 PM



In message <3BE7A558-4A9D-44A5-9C2F-FEE9DAAEB5C2 (AT) microsoft (DOT) com>, Jamie
Carper <JamieCarper (AT) discussions (DOT) microsoft.com> writes
Quote:
Hi Darren,

This is the only line I needed to see. Thanks.


oTask.Execute oPkg, Nothing, Nothing, CLng(0)


And yes, I agree it is best to reference an existing Task. Which is exactly
what I am trying to do. I just needed to know how to execute that task
without a workflow.

I will give the above syntax a try.

Jamie
Perhaps I should clarify, I really do not recommend executing tasks
directly, new or existing. Let workflow determine the execution of a
package. Still if it works, then.....

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.