Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 DTS Global Variables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-26 : 11:16:55
Chris writes "I've set a number of DTSGlobalVariables in a DTS package. In a later step, I want to set a local variable in an 'EXECUTE SQL TASK' to the DTSGlobalVariable. Problem is that I don't need a query like:

SELECT * FROM TableX WHERE ColumnX = ?

What I need to do is set a local variable = to the DTSGlobalVariable like:

SET @LocVariable = ? (where ? is an input global variable)
or
SELECT @LocVariable = DTSGlobalVariables("GlobalVarName").value

It seems that since I am using the ? in a SET or SELECT statement without a FROM or WHERE statement, the input parameter ? is invalid and I can't reference the GVariable.

I could work around this by taking the whole EXECUTE SQL TASK and rewording it as an ActiveX Script Task, but I wanted to see if there was a way to set the global variable = to a local variable in an EXECUTE SQL TASK.

Possible???
I'm using SQL Server 2000 SP2 on a Window 2000 Server.
Thanks!!"

setbasedisthetruepath
Used SQL Salesman

992 Posts

Posted - 2002-08-26 : 12:08:48
An easier approach is to write a stored procedure that accepts an input parameter, and run 'exec {sp name} ?' in the execute sql task.

Jonathan Boott, MCDBA
{0}
Go to Top of Page
   

- Advertisement -