Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server DTS
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 19th, 2004, 11:03 AM
Authorized User
 
Join Date: Oct 2004
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
 
Old November 23rd, 2004, 12:53 PM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old November 24th, 2004, 07:06 AM
Authorized User
 
Join Date: Oct 2004
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?
 
Old November 24th, 2004, 07:12 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old November 24th, 2004, 08:45 AM
Authorized User
 
Join Date: Oct 2004
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help.









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.