all groups > sql server dts > may 2007 >
You're in the

sql server dts

group:

Can I call a Script Task from other Script Task?


Can I call a Script Task from other Script Task? Sachin Chavan
5/12/2007 3:04:01 AM
sql server dts:
Hello,

Can I call a Script Task from Other Script Task?

Actually, what I am trying to acheive is:

I have a piece of code Like some Functions that I keep using over n over in
all of my script task e.g. functions for Reading n Writing Package Variables
and Instantiating some .Net Objects.

Now, If 2morrow something changes to this common stuff used everywhere I
need to edit each n every Script Task.

So, for the sake of maintainability, I want all the common stuff in one
Script task n I will keep calling the required function out of it e.g.
read/write as and when required from my rest of the script Tasks.

Is this possible??

Plz Plz do provide the code for the same, if this can be acheived.

Thanks,
Sachin R. Chavan.
Re: Can I call a Script Task from other Script Task? Allan Mitchell
5/12/2007 5:31:10 PM
Hello Sachin,


In DTS you can certainly do this.

Imagine this

In a script task I have this

Function Main()
Main = DTSTaskExecResult_Success
End Function

Function X(Y, Z)

X = Y + Z

End Function

This task is disabled

I have another script task which will now call the function X from the first
script task and retrieve the value

Function Main()

dim ax,i,str

set ax = DTSGlobalVariables.Parent.Tasks("DTSTask_DTSActiveScriptTask_1").CustomTask

Execute(ax.ActiveXScript)

i = X(1,99)

Msgbox(CStr(i))

Main = DTSTaskExecResult_Success
End Function



--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

[quoted text, click to view]

RE: Can I call a Script Task from other Script Task? weilu NO[at]SPAM online.microsoft.com
5/16/2007 12:00:00 AM
Hi ,

How is everything going? Please feel free to let me know if you need any
assistance.

Sincerely,

Wei Lu
Microsoft Online Community Support

==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Re: Can I call a Script Task from other Script Task? Sachin Chavan
5/16/2007 3:01:01 AM

Hello Allan,

Sorry for replying little late. Last 2-3 days I was too much occupied as I
had Phase1 release of my Integration Package.

In continuation to your reply.....

I tried your solution but there is no class called 'DTSGlobalVariables' in
SSIS 2005, I guess you have provided soln for DTS 2000 or forget to mention
any namespace, I need to include in Imports section.

Actually, what I wanted to know was, some way to call a function in a script
Task in 'SSIS 2005 Package' from other Script Task in same package.

In my last post I forgot to mention 'for SSIS 2005' ....

Is there any way I can acheive this??

Plz let me know.

Thanks,
Sachin R. Chavan.


[quoted text, click to view]
Re: Can I call a Script Task from other Script Task? Allan Mitchell
5/16/2007 7:49:22 PM
Hello Sachin,

OK so in your original post there was no mention of SSIS and this is the
..dts NG so I took it to be DTS. Tasks have no way of seeing each other.
This is by design to stop us playing with things and causing an unstable
package. The way I would do this in SSIS (and have done) is to register
an external assembly. This assembly will have the methods you need. This
way you can register and call wherever you like

--

Allan Mitchell
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com |
http://www.konesans.com

[quoted text, click to view]


AddThis Social Bookmark Button