dbTalk Databases Forums  

trying to bind 2 global variables in a DTS Execute SQL Task

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


Discuss trying to bind 2 global variables in a DTS Execute SQL Task in the microsoft.public.sqlserver.dts forum.



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

Default trying to bind 2 global variables in a DTS Execute SQL Task - 08-25-2005 , 03:33 PM






I am writing a DTS package that gets executed remotely. The remote exectution
passes a value that populates the global variable of the main DTS package,
MainVar1.

There are several other variables in the package that are dependent on
MainVar1 variable.
What I am trying to do is concatinate these variables for diefferent parts
of the package. MainVar1 is basically a path and the other variables are
files names, FileVar1, FileVar2, on and on.

Each concantination would then be bound to a gloval variable, Result1,
Result2 and so on.

I tried in the execute SQL Task:
select ?, ? as result1
and tried to bind the ? to the Parameters list, but I get Syntax Error. I
guess the ? cannot be in a Select list.

I also tried to use a UDF MergeString(?,?) with the same issue also.

Anyone know how to get around this?

Thanks
Eric

Reply With Quote
  #2  
Old   
Thomas Bradshaw via SQLMonster.com
 
Posts: n/a

Default Re: trying to bind 2 global variables in a DTS Execute SQL Task - 08-25-2005 , 05:12 PM






Have you tried using an ActiveX Script task instead? The first step in your
package could be a task that does something like this:

Function Main()
dim Path, f1, f2

Path = DTSGlobalVariables("PathVar").Value ' Something like C:\
Temp\

f1 = Path & DTSGlobalVariables("FileVar1").Value
f2 = Path & DTSGlobalVariables("FileVar2").Value

DTSGlobalVariables("Result1").Value = f1
DTSGlobalVariables("Result2").Value = f2

Main = DTSTaskExecResult_Success
End Function

- Tom


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...r-dts/200508/1

Reply With Quote
  #3  
Old   
Spaz
 
Posts: n/a

Default Re: trying to bind 2 global variables in a DTS Execute SQL Task - 08-26-2005 , 10:26 AM



Works great. THANKS!
Just to note for others.
I set up each package as follows:

ActiveX package ->complete-> Dynamic Properties Package ->complete-> my
other tasks

and set up the call from VB like:
oPKG.GlobalVariables.Item("PathVar").let_Value(Tex tBox2.Text)
Console.WriteLine("PathVar: {0}",
CType(oPKG.GlobalVariables.Item("PathVar").Value, System.String))
oPKG.Execute()


Eric


"Thomas Bradshaw via SQLMonster.com" wrote:

Quote:
Have you tried using an ActiveX Script task instead? The first step in your
package could be a task that does something like this:

Function Main()
dim Path, f1, f2

Path = DTSGlobalVariables("PathVar").Value ' Something like C:\
Temp\

f1 = Path & DTSGlobalVariables("FileVar1").Value
f2 = Path & DTSGlobalVariables("FileVar2").Value

DTSGlobalVariables("Result1").Value = f1
DTSGlobalVariables("Result2").Value = f2

Main = DTSTaskExecResult_Success
End Function

- Tom


--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums...r-dts/200508/1


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.