all groups > sql server dts > august 2005 >
You're in the

sql server dts

group:

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



trying to bind 2 global variables in a DTS Execute SQL Task Spaz
8/25/2005 1:33:04 PM
sql server dts: 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
Re: trying to bind 2 global variables in a DTS Execute SQL Task Thomas Bradshaw via SQLMonster.com
8/25/2005 10:12:30 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
Re: trying to bind 2 global variables in a DTS Execute SQL Task Spaz
8/26/2005 8:26:09 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(TextBox2.Text)
Console.WriteLine("PathVar: {0}",
CType(oPKG.GlobalVariables.Item("PathVar").Value, System.String))
oPKG.Execute()


Eric


[quoted text, click to view]
AddThis Social Bookmark Button