Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Global variable Expand / Collapse
Author
Message
Posted Thursday, August 27, 2009 8:19 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 16, 2009 1:21 PM
Points: 3, Visits: 15
Hi All, i am trying to do following scenario to fetch the latest data when i execute the DTS package


Source is DB2 and target is Oracle

First i defined execute SQL task and fetching the max(load_date) from target table and store it in a variable called date1.
select max(load_date) into date1 from target_table.
Now in my Transform Data task properties i am using that variable on Source Query like this..
select * from source_table where lod_date > date1

But when i execute the DTS package, it ran successfully without any errors. Then i figured it, the variable i defined is local to that execute SQL task.

Now, i defined a Global variable and i am trying to assign the same values that come from the following query.

select max(load_date) into date1 from target_table.

like this

dim max_date
set DTSGlobalVariables("date1").Value = max_date
set max_date = 'select max(load_date) into date1 from target_table'
Main = DTSTaskExecResults_Success
EndFunction.

But my problem is i am getting systax error while set the max_date value through the SQL.

It would be great if someone can help to resolve this issue?

Thanks in Advance

Thanks
Post #778332
Posted Friday, August 28, 2009 11:26 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, September 16, 2009 1:21 PM
Points: 3, Visits: 15
Hi all, i resoveld this issue..I did following steps

i wrote a select statement in my execute SQL task to select the max date
and assign that to output variable.
And i called that output variable in data transform Task.

I thought this might be helpful if someone read this post.

Thanks a lot everyone..
Post #779248
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse