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 October 7th, 2005, 03:08 PM
Registered User
 
Join Date: Oct 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Global Variables and SQL statements in DTS

Sybase does not allow parameterized SQL statements. Therefore, I must build my SQL statement using Global variables. I'm new to DTS and I found the link below. What do you do with this ActiveX Script Task after it is built? How/Where do you send the recordset to be processed?

http://www.sqldts.com/default.aspx?205


' 205 (Change SourceSQLStatement)
Option Explicit

Function Main()
    Dim oPkg, oDataPump, sSQLStatement

    ' Build new SQL Statement
    sSQLStatement = "SELECT * FROM dbo.employee WHERE hire_date > '" & _
        DTSGlobalVariables("HireDate").Value & "'"

    ' Get reference to the DataPump Task
    Set oPkg = DTSGlobalVariables.Parent
    Set oDataPump = oPkg.Tasks("DTSTask_DTSDataPumpTask_1").CustomTask

    ' Assign SQL Statement to Source of DataPump
    oDataPump.SourceSQLStatement = sSQLStatement

    ' Clean Up
    Set oDataPump = Nothing
    Set oPkg = Nothing

    Main = DTSTaskExecResult_Success
End Function




Thanks,

gmctrek





Similar Threads
Thread Thread Starter Forum Replies Last Post
DTS package Global Var's frank.svs SQL Server DTS 0 July 16th, 2007 06:18 AM
Global variables ps124 ASP.NET 1.0 and 1.1 Basics 6 April 6th, 2004 02:48 PM
Setting a DTS Global Variable ioates SQL Server 2000 0 October 23rd, 2003 04:28 AM
Passing global integers to SQL statements Kenny Alligood Access VBA 4 August 14th, 2003 10:00 AM
Quoting variables in SQL statements tp194 Classic ASP Databases 1 July 4th, 2003 03:41 AM





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