Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DTS and Global Variables

Status
Not open for further replies.

Fuzemmo

Programmer
May 16, 2002
52
US
I'm trying to modify the SQL statement of an Execute SQL Task using a Dynamic Properties Task. I can successfully modify the SQL statement via a new query in the Dynamic Properties Task, but I can't seem to use the global variable that I've created.

For example, if my Dynamic Propterties Query is:

DECLARE @sql VarChar(4000)
SELECT @sql = 'SELECT 100'
SELECT @sql

Then the query statement in my Execute SQL Task is successfully changed to:

SELECT 100

But, when I try to utilize a global variable, such as in this:

DECLARE @sql VarChar(4000)
SELECT @sql = 'SELECT ' + DTSGlobalVariables("rpt_dt").Value
SELECT @sql

I get a message stating that...
DTSGlobalVariables is not a recognized function name

Can anyone assist?
Jim
 
Jim,

Try:

Dim sSQL
sSQL = DTSGlobalVariables("rpt_dt").Value

to obtain the value and then concatonate it with the rest of the statement.

Logicalman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top