Friday, March 9, 2012

How to call a sub-package by name only?

You could of course simply use an Active Script task and call the package
that way OR an ExecuteProcess task with DTSRUN.
I have just followed the article and it works for me.
--
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:ObapPeJTEHA.3768@.TK2MSFTNGP11.phx.gbl...
> (SQL Server 2000, SP3a)
> Hello all!
> I've got a package that has several "Execute Package Task" elements. I'd
like to make the
> sub-packages version-independent. I ran across this blurb:
> http://www.sqldts.com/default.aspx?216
> Which talks about blanking the PackageID. I've done exactly as this has
described (both
> by blanking the PackageID with "Disconnected Edit" *and* by having a blank
Global Variable
> that I set the PackageIDs to). However, when I invoke my outer package, I
keep getting an
> "invalid GUID".
> Any help would be greatly appreciated. Thanks!
> John Peterson
>Thanks Allan!
I *think* I might be having some issues with the blank global variable being
"<not
displayable>". That is, when I use the Global Variable editor to "blank" ou
t my PackageID
GV, everything works. However, if I save my package (as Structured Storage)
, exit the
package, and re-run it, I consistently get the "Invalid GUID specified" erro
r. If I edit
the PackageID GV to blank it out again, then it works.
I even added a ActiveX task to set the PackageID GV:
' Ensure that the PackageID global variable is blank.
DTSGlobalVariables("PackageID").Value = ""
But upon initial load of the package, it still fails until I manually "dink"
that GV.
If you have the time and inclination, could you try that and let me know of
your results?
Many regards,
John Peterson
"Allan Mitchell" <allan@.no-spam.sqldts.com> wrote in message
news:eUuOQuJTEHA.2128@.TK2MSFTNGP11.phx.gbl...
> You could of course simply use an Active Script task and call the package
> that way OR an ExecuteProcess task with DTSRUN.
> I have just followed the article and it works for me.
>
> --
> --
> Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
> www.SQLDTS.com - The site for all your DTS needs.
> I support PASS - the definitive, global community
> for SQL Server professionals - http://www.sqlpass.org
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:ObapPeJTEHA.3768@.TK2MSFTNGP11.phx.gbl...
> like to make the
> described (both
> Global Variable
> keep getting an
>|||What I think then is happening is that you are saying "" which is not empty.
Why do you have a GV setting the Package GUID in the first place if you do
not want to use it?
I would remove this altogether or if you want to occasionally specify the
GUID and sometimes not then I would do it in an Active Script task where i
could decide to use/or not based on a certain condition
--
Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:OsbAS6JTEHA.3548@.TK2MSFTNGP09.phx.gbl...
> Thanks Allan!
> I *think* I might be having some issues with the blank global variable
being "<not
> displayable>". That is, when I use the Global Variable editor to "blank"
out my PackageID
> GV, everything works. However, if I save my package (as Structured
Storage), exit the
> package, and re-run it, I consistently get the "Invalid GUID specified"
error. If I edit
> the PackageID GV to blank it out again, then it works.
> I even added a ActiveX task to set the PackageID GV:
> ' Ensure that the PackageID global variable is blank.
> DTSGlobalVariables("PackageID").Value = ""
> But upon initial load of the package, it still fails until I manually
"dink" that GV.
> If you have the time and inclination, could you try that and let me know
of your results?
> Many regards,
> John Peterson
>
> "Allan Mitchell" <allan@.no-spam.sqldts.com> wrote in message
> news:eUuOQuJTEHA.2128@.TK2MSFTNGP11.phx.gbl...
package[vbcol=seagreen]
I'd[vbcol=seagreen]
has[vbcol=seagreen]
blank[vbcol=seagreen]
package, I[vbcol=seagreen]
>|||Sorry, I should have been more clear: I *always* want to call the sub-packa
ge by name
only, so I *do* want to use the GV to set the PackageID. The problem is, it
seems like
DTS is sometimes replacing the actual string of "<not displayable>" for the
PackageID when
I first load the package, which will then generate the "Invalid GUID specifi
ed" error. It
seems like I need to manually clear out the GV the first time I run it in th
e designer.
"Allan Mitchell" <allan@.no-spam.sqldts.com> wrote in message
news:uMVOqBTTEHA.1732@.TK2MSFTNGP09.phx.gbl...
> What I think then is happening is that you are saying "" which is not empt
y.
> Why do you have a GV setting the Package GUID in the first place if you do
> not want to use it?
> I would remove this altogether or if you want to occasionally specify the
> GUID and sometimes not then I would do it in an Active Script task where i
> could decide to use/or not based on a certain condition
> --
> --
> Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
> www.SQLDTS.com - The site for all your DTS needs.
> I support PASS - the definitive, global community
> for SQL Server professionals - http://www.sqlpass.org
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:OsbAS6JTEHA.3548@.TK2MSFTNGP09.phx.gbl...
> being "<not
> out my PackageID
> Storage), exit the
> error. If I edit
> "dink" that GV.
> of your results?
> package
> I'd
> has
> blank
> package, I
>|||John
If you never want to load the DTS package using either the Package and
Version GUID, then I'd do as Allan has suggested and put either,
a) Blank out the GUIDs using disconnected edit. They will only come back if
you edit that task in the designer.
b) Write a short ActiveScript task to blank out the GUIDs at the start of
the package.
Here is a script I use to accomplish that,
<-- Start -->
Dim oPkg
Dim colTasks
Dim sTsk
' open DTS package object so we can get the package details
Set oPkg = DTSGlobalVariables.Parent
' open object referring to Tasks collection
Set colTasks = oPkg.Tasks
' for each item in the collection
For Each sTsk in colTasks
' check if the task is an Execute Package task
If InStr(1, sTsk.Name, "DTSExecutePackageTask", vbTextCompare ) > 0 Then
' create object referring to selected task
Set oTsk = oPkg.Tasks(sTsk.Name)
' blank out Package and VersionIDs so package loads by name only
' this will ensure that only the latest version is loaded.
oTsk.Properties("PackageID").Value = ""
oTsk.Properties("VersionID").Value = ""
' release object that was created
Set oTsk = Nothing
End If
Next
Set colTasks = Nothing
Set oPkg = Nothing
<-- End -->
Thanks
Phill
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:urAJ4tVTEHA.3548@.TK2MSFTNGP09.phx.gbl...
> Sorry, I should have been more clear: I *always* want to call the
sub-package by name
> only, so I *do* want to use the GV to set the PackageID. The problem is,
it seems like
> DTS is sometimes replacing the actual string of "<not displayable>" for
the PackageID when
> I first load the package, which will then generate the "Invalid GUID
specified" error. It
> seems like I need to manually clear out the GV the first time I run it in
the designer.
>
> "Allan Mitchell" <allan@.no-spam.sqldts.com> wrote in message
> news:uMVOqBTTEHA.1732@.TK2MSFTNGP09.phx.gbl...
empty.[vbcol=seagreen]
do[vbcol=seagreen]
the[vbcol=seagreen]
i[vbcol=seagreen]
"blank"[vbcol=seagreen]
specified"[vbcol=seagreen]
know[vbcol=seagreen]
elements.[vbcol=seagreen]
this[vbcol=seagreen]
a[vbcol=seagreen]
>|||Thanks Phil!
Ah -- I thought I might need to constantly set the PackageID to blank (hence
the global
variable approach). But it sounds like I really only need to do this *once*
with the
Disconnected Edit feature (unless I edit the task again, of course).
Thanks for the sample script!
John Peterson
"Phill Carter" <pcarter@.no-spam.bellpotter.com.au> wrote in message
news:edtCtxaTEHA.204@.TK2MSFTNGP10.phx.gbl...
> John
> If you never want to load the DTS package using either the Package and
> Version GUID, then I'd do as Allan has suggested and put either,
> a) Blank out the GUIDs using disconnected edit. They will only come back i
f
> you edit that task in the designer.
> b) Write a short ActiveScript task to blank out the GUIDs at the start of
> the package.
> Here is a script I use to accomplish that,
> <-- Start -->
> Dim oPkg
> Dim colTasks
> Dim sTsk
> ' open DTS package object so we can get the package details
> Set oPkg = DTSGlobalVariables.Parent
> ' open object referring to Tasks collection
> Set colTasks = oPkg.Tasks
> ' for each item in the collection
> For Each sTsk in colTasks
> ' check if the task is an Execute Package task
> If InStr(1, sTsk.Name, "DTSExecutePackageTask", vbTextCompare ) > 0 Then
> ' create object referring to selected task
> Set oTsk = oPkg.Tasks(sTsk.Name)
> ' blank out Package and VersionIDs so package loads by name only
> ' this will ensure that only the latest version is loaded.
> oTsk.Properties("PackageID").Value = ""
> oTsk.Properties("VersionID").Value = ""
> ' release object that was created
> Set oTsk = Nothing
> End If
> Next
> Set colTasks = Nothing
> Set oPkg = Nothing
> <-- End -->
> --
> Thanks
> Phill
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:urAJ4tVTEHA.3548@.TK2MSFTNGP09.phx.gbl...
> sub-package by name
> it seems like
> the PackageID when
> specified" error. It
> the designer.
> empty.
> do
> the
> i
> "blank"
> specified"
> know
> elements.
> this
> a
>|||"...then you can remove the dependency on the PackageID, by blanking out the
PackageID property of the ExecutePackageTask... This can be done as a
one-off exercise with the Disconnected Edit feature..."
"If you regularly migrate packages and do not want to have to worry about
this, you can add a Dynamic Properties task to perform this during package
run-time..."
Is it not clear that you do this once, unless you change things?
Darren Green
http://www.sqldts.com
"John Peterson" <j0hnp@.comcast.net> wrote in message
news:e9rLYwdTEHA.1172@.TK2MSFTNGP11.phx.gbl...
> Thanks Phil!
> Ah -- I thought I might need to constantly set the PackageID to blank
(hence the global
> variable approach). But it sounds like I really only need to do this
*once* with the
> Disconnected Edit feature (unless I edit the task again, of course).
> Thanks for the sample script!
> John Peterson
>
> "Phill Carter" <pcarter@.no-spam.bellpotter.com.au> wrote in message
> news:edtCtxaTEHA.204@.TK2MSFTNGP10.phx.gbl...
if[vbcol=seagreen]
of[vbcol=seagreen]
Then[vbcol=seagreen]
is,[vbcol=seagreen]
for[vbcol=seagreen]
in[vbcol=seagreen]
not[vbcol=seagreen]
you[vbcol=seagreen]
specify[vbcol=seagreen]
where[vbcol=seagreen]
variable[vbcol=seagreen]
Structured[vbcol=seagreen]
manually[vbcol=seagreen]
me[vbcol=seagreen]
the[vbcol=seagreen]
as[vbcol=seagreen]
having[vbcol=seagreen]
outer[vbcol=seagreen]
>|||"Darren Green" <darren.green@.reply-to-newsgroup-sqldts.com> wrote in message
news:eivN0%23fTEHA.3476@.tk2msftngp13.phx.gbl...
> "...then you can remove the dependency on the PackageID, by blanking out t
he
> PackageID property of the ExecutePackageTask... This can be done as a
> one-off exercise with the Disconnected Edit feature..."
> "If you regularly migrate packages and do not want to have to worry about
> this, you can add a Dynamic Properties task to perform this during package
> run-time..."
> Is it not clear that you do this once, unless you change things?
It wasn't clear to me. Does "migrate packages" mean change them? Or move t
hem from place
to place? Or how do I interpret that?

> --
> Darren Green
> http://www.sqldts.com
>
> "John Peterson" <j0hnp@.comcast.net> wrote in message
> news:e9rLYwdTEHA.1172@.TK2MSFTNGP11.phx.gbl...
> (hence the global
> *once* with the
> if
> of
> Then
> is,
> for
> in
> not
> you
> specify
> where
> variable
> Structured
> manually
> me
> the
> as
> having
> outer
>

No comments:

Post a Comment