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
| FAQ | Members List | 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 Search this Thread Display Modes
  #1 (permalink)  
Old May 13th, 2005, 08:19 AM
Registered User
Join Date: May 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DTSGlobalVar lose its value in VBScript

Hi, all,
i have a strange problem with the following VBscript-Code:

Function Main()

    ''''''''''DTSGlobalVariables("myGlobVar").Value = "xyz"

    If DTSGlobalVariables("myGlobVar").Value = "xyz" Then

        sTmpVar = DTSGlobalVariables("myGlobVar").Value
        retVal = doSomething( sTmpVar )
        MsgBox retVal

    End If

Function doSomething( sTmpVar ) 
    doSomething = retVal
End Function
The Problem is with the following call from a SQL-Stored Procedure:

dtsrun /S myserver /U sa /P sa /N MyPacket /M sa /A myGlobVar:8="xyz"

At runtime, the If-Condition gets true, but then sTmpVar is NULL
and I get the report of a runtime error in doSomething().
The DTSGlobalVariable is set correctly in the Package Properties
and when I set the DTSGlobalVariable inside the Main-Function of this
script, it works.

Thanks for every tip

  #2 (permalink)  
Old May 20th, 2005, 03:50 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

Other than re-arrange the code to:
Function Main()

    ''''''''''DTSGlobalVariables("myGlobVar").Value = "xyz"
    Dim sTmpVar
    sTmpVar = DTSGlobalVariables("myGlobVar").Value 
    If sTmpVar = "xyz" Then    
         retVal = doSomething( sTmpVar )
        MsgBox retVal

    End If
I can't see why your code fails.

Are you sure that you haven't mistyped an identifier? Do you have Option Explicit set?


Joe (Microsoft MVP - XML)
  #3 (permalink)  
Old August 29th, 2005, 03:26 PM
Registered User
Join Date: Jul 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts

I have the same problem. In an active X script, I assign today's
date to gv_ImportDate, after having created the global variable. Then I display it in a message box to test it. Msgbox displays the
correct date.

However, I cannot use the variable in the where clause of a SQL
query. I am trying to return data from JET. It succeeds if I
hard code my where clause to "where info_dt = #8/28/2005#"

Any help out there please?


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
User controls lose data edibusl ASP.NET 2.0 Basics 0 October 7th, 2006 09:10 AM
Avoid Warning Message on C lose Windows qazi_nomi Javascript 9 September 11th, 2004 11:19 AM
Help! At a lose: SQL and VB xgbnow Pro VB Databases 2 June 9th, 2004 10:12 PM
Why do I lose 0 Zero's when calculating? easybee Classic ASP Databases 1 December 18th, 2003 12:34 AM

All times are GMT -4. The time now is 04:22 AM.

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