dbTalk Databases Forums  

DTS Steps in wrong order

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


Discuss DTS Steps in wrong order in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chris Lieb
 
Posts: n/a

Default DTS Steps in wrong order - 05-16-2005 , 09:48 AM






I am trying to recreate the dialog that appears when you manually run a DTS
package (DTS.Package2) in SQL Server 2000. To populate the list, I iterate
through the Tasks collection and put each item's description in its own row.
Only
problem is that the Tasks are not in the same order that they run in. So,
according to the dialog box, the last action that I am taking is clearing the
table instead of populating it.

Thanks

--
Chris Lieb
UPS CACH, Hodgekins, IL
Tech Support Group - Systems/Apps

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

Default Re: DTS Steps in wrong order - 05-16-2005 , 12:09 PM






You would need to examine each step, and go down to the precedence
constraints. Examine all of these to determine execution order. Not a
trivial task on complicated workflow packages.

You could always look at using the SQL-NS execution method, which gives you
the dialog from EM, but no access to the object like the regular methods.
Try the SQL-NS browser sample that ships with SQL 2000 just to try it out.


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com



"Chris Lieb" <ChrisLieb (AT) discussions (DOT) microsoft.com> wrote

Quote:
I am trying to recreate the dialog that appears when you manually run a
DTS
package (DTS.Package2) in SQL Server 2000. To populate the list, I
iterate
through the Tasks collection and put each item's description in its own
row.
Only
problem is that the Tasks are not in the same order that they run in. So,
according to the dialog box, the last action that I am taking is clearing
the
table instead of populating it.

Thanks

--
Chris Lieb
UPS CACH, Hodgekins, IL
Tech Support Group - Systems/Apps



Reply With Quote
  #3  
Old   
Chris Lieb
 
Posts: n/a

Default Re: DTS Steps in wrong order - 05-16-2005 , 01:29 PM



Do you have some pseudocode for such an algorithm? I am having a hard time
thinking of a way to sort them.

Also, what is the difference between DTS.Package and DTS.Package2 or
DTS.Step and DTS.Step2? Is there one that I should be using over the other?

Thanks,
Chris Lieb

"Darren Green" wrote:

Quote:
You would need to examine each step, and go down to the precedence
constraints. Examine all of these to determine execution order. Not a
trivial task on complicated workflow packages.

You could always look at using the SQL-NS execution method, which gives you
the dialog from EM, but no access to the object like the regular methods.
Try the SQL-NS browser sample that ships with SQL 2000 just to try it out.


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com



"Chris Lieb" <ChrisLieb (AT) discussions (DOT) microsoft.com> wrote in message
news:688A32E8-019B-457C-BF55-C578CDA4F29B (AT) microsoft (DOT) com...
I am trying to recreate the dialog that appears when you manually run a
DTS
package (DTS.Package2) in SQL Server 2000. To populate the list, I
iterate
through the Tasks collection and put each item's description in its own
row.
Only
problem is that the Tasks are not in the same order that they run in. So,
according to the dialog box, the last action that I am taking is clearing
the
table instead of populating it.

Thanks

--
Chris Lieb
UPS CACH, Hodgekins, IL
Tech Support Group - Systems/Apps




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

Default Re: DTS Steps in wrong order - 05-16-2005 , 02:07 PM




Find a step which is not mentioned in any other step's precedence
constraints StepName property. This is the start step. May be more than
one. This is the top of the tree, so add to UI list. For each of these
start steps, find any steps that reference then by the constraint's
StepName, add those steps to your UI, and repeat.

The Object2 stuff is the SQL 2000 object which inherits from the SQL 7.0
named Object. SQL 2000 instances have additional properties and methods.
If you need to be SQL 7 compatible, then don't use Object2.

Darren

In message <60AC06FD-4AD6-4957-8B40-6252EF0F9396 (AT) microsoft (DOT) com>, Chris
Lieb <ChrisLieb (AT) discussions (DOT) microsoft.com> writes
Quote:
Do you have some pseudocode for such an algorithm? I am having a hard time
thinking of a way to sort them.

Also, what is the difference between DTS.Package and DTS.Package2 or
DTS.Step and DTS.Step2? Is there one that I should be using over the other?

Thanks,
Chris Lieb

"Darren Green" wrote:

You would need to examine each step, and go down to the precedence
constraints. Examine all of these to determine execution order. Not a
trivial task on complicated workflow packages.

You could always look at using the SQL-NS execution method, which gives you
the dialog from EM, but no access to the object like the regular methods.
Try the SQL-NS browser sample that ships with SQL 2000 just to try it out.


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com



"Chris Lieb" <ChrisLieb (AT) discussions (DOT) microsoft.com> wrote in message
news:688A32E8-019B-457C-BF55-C578CDA4F29B (AT) microsoft (DOT) com...
I am trying to recreate the dialog that appears when you manually run a
DTS
package (DTS.Package2) in SQL Server 2000. To populate the list, I
iterate
through the Tasks collection and put each item's description in its own
row.
Only
problem is that the Tasks are not in the same order that they run in. So,
according to the dialog box, the last action that I am taking is clearing
the
table instead of populating it.

Thanks

--
Chris Lieb
UPS CACH, Hodgekins, IL
Tech Support Group - Systems/Apps



--
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
  #5  
Old   
Chris Lieb
 
Posts: n/a

Default Re: DTS Steps in wrong order - 05-16-2005 , 02:46 PM



I've developed this algorithm to sort the steps:

Private Function OrderSteps() As DTS.Steps
Dim i As Integer, j As Integer
Dim prec As DTS.PrecedenceConstraints
Dim list As DTS.Steps
Set list = oPkg.Steps

For i = 1 To list.Count
Set prec = list(i).PrecedenceConstraints
For j = i To list.Count
If isRequired(list(j), prec) Then
Dim temp As DTS.Step2
Set temp = list(j)
list.Remove j
list.Insert i, temp
End If
Next j
Next i

Set OrderSteps = list
End Function

Private Function isRequired(item As DTS.Step, prec As
DTS.PrecedenceConstraints) As Boolean
Dim i As Integer
For i = 1 To prec.Count
If item.Name = prec(i).StepName Then
isRequired = True
Exit Function
End If
Next i
isRequired = False
End Function

Unfortunately, even though it sorts everything correctly, when it returns,
every item but the first on dissapears even though the count stays the same.
Every time I try to access an element after the first, I get an error about
accessing an invalid memory address, or something like that, and VB crashes.
When you look at the variable in the watch window, it shows the properties
Count and Parent, but all of the Item? entries disappear. What can I do to
fix this?

"Darren Green" wrote:

Quote:
Find a step which is not mentioned in any other step's precedence
constraints StepName property. This is the start step. May be more than
one. This is the top of the tree, so add to UI list. For each of these
start steps, find any steps that reference then by the constraint's
StepName, add those steps to your UI, and repeat.

The Object2 stuff is the SQL 2000 object which inherits from the SQL 7.0
named Object. SQL 2000 instances have additional properties and methods.
If you need to be SQL 7 compatible, then don't use Object2.

Darren

In message <60AC06FD-4AD6-4957-8B40-6252EF0F9396 (AT) microsoft (DOT) com>, Chris
Lieb <ChrisLieb (AT) discussions (DOT) microsoft.com> writes
Do you have some pseudocode for such an algorithm? I am having a hard time
thinking of a way to sort them.

Also, what is the difference between DTS.Package and DTS.Package2 or
DTS.Step and DTS.Step2? Is there one that I should be using over the other?

Thanks,
Chris Lieb

"Darren Green" wrote:

You would need to examine each step, and go down to the precedence
constraints. Examine all of these to determine execution order. Not a
trivial task on complicated workflow packages.

You could always look at using the SQL-NS execution method, which gives you
the dialog from EM, but no access to the object like the regular methods.
Try the SQL-NS browser sample that ships with SQL 2000 just to try it out.


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com



"Chris Lieb" <ChrisLieb (AT) discussions (DOT) microsoft.com> wrote in message
news:688A32E8-019B-457C-BF55-C578CDA4F29B (AT) microsoft (DOT) com...
I am trying to recreate the dialog that appears when you manually run a
DTS
package (DTS.Package2) in SQL Server 2000. To populate the list, I
iterate
through the Tasks collection and put each item's description in its own
row.
Only
problem is that the Tasks are not in the same order that they run in. So,
according to the dialog box, the last action that I am taking is clearing
the
table instead of populating it.

Thanks

--
Chris Lieb
UPS CACH, Hodgekins, IL
Tech Support Group - Systems/Apps




--
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.