Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old November 19th, 2004, 10:03 AM
Authorized User
 
Join Date: Oct 2004
Location: Bristol, Nth. Somerset, United Kingdom.
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default Use of DTSStep_DTSActiveScriptTask_4

I've a large DTS script which replies on the presence of an Access database. The first thing the script does is check for the presence of the Access database and then depending on if its found or not it takes a different course. The ActiveX script below uses a number of lines of code based on code similar to "DTSStep_DTSActiveScriptTask_4".

What I cannot work out is what DTSStep_DTSActiveScriptTask_4 refers to. I assume its a module within the DTS script but which one?


Function Main()

Dim oConnection, oFile, oFSO, oStep
Dim sFileName

'get ref to accessconnection
Set oConnection = DTSGlobalVariables.Parent.Connections("Access Corrections")

'get expected file name
sFileName = oConnection.DataSource
DTSGlobalVariables("TargetFileName") = sFileName
'clean up
Set oConnection = Nothing
Set oFSO = CreateObject("Scripting.FileSystemObject")

'check if file exists
If Not oFSO.FileExists(sFileName) Then
    'swap round success and failure workflow
    Set oStep = DTSGlobalVariables.Parent.Steps"DTSStep_DTSActiveS criptTask_3")
        oStep.PrecedenceConstraints("DTSStep_DTSActiveScri ptTask_1").Value = 0
        Set oStep = DTSGlobalVariables.Parent.Steps("DTSStep_DTSActive ScriptTask_4")
        oStep.PrecedenceConstraints("DTSStep_DTSActiveScri ptTask_1").Value = 1
    Else
        Set oStep = DTSGlobalVariables.Parent.Steps("DTSStep_DTSActive ScriptTask_3")
        oStep.PrecedenceConstraints("DTSStep_DTSActiveScri ptTask_1").Value = 1
        Set oStep = DTSGlobalVariables.Parent.Steps("DTSStep_DTSActive ScriptTask_4")
        oStep.PrecedenceConstraints("DTSStep_DTSActiveScri ptTask_1").Value = 0
    End If

    ' clean Up
    Set oFSO = Nothing
    Main = DTSTaskExecResult_Success

End Function
  #2 (permalink)  
Old November 23rd, 2004, 11:53 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It's the default name given to a script task which was the fourth created by the designer who should have been kind enough to rename them to sensibly names. You should be able to look in the designer and see what it does.
If not, save the package to a VB6 file and post it here.

--

Joe (Microsoft MVP - XML)
  #3 (permalink)  
Old November 24th, 2004, 06:06 AM
Authorized User
 
Join Date: Oct 2004
Location: Bristol, Nth. Somerset, United Kingdom.
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your reply.

As soon as I saved it to a VB file and searched through the resulting file the different steps became obvious.

Are you able to comment on the use of:

Set oStep = DTSGlobalVariables.Parent.Steps

and the assignment of O and 1 as in

oStep.PrecedenceConstraints("DTSStep_DTSActiveScri ptTask_1").Value = 0

Is this switching certain modules on or off?
  #4 (permalink)  
Old November 24th, 2004, 06:12 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It's setting whether the step is executed or not, 0 is yes, 1 is no. They are swapped depending on if the file is present, see Creating Precedence Contraints



--

Joe (Microsoft MVP - XML)
  #5 (permalink)  
Old November 24th, 2004, 07:45 AM
Authorized User
 
Join Date: Oct 2004
Location: Bristol, Nth. Somerset, United Kingdom.
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help.
 


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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off



All times are GMT -4. The time now is 08:48 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.