SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Global variable


Global variable

Author
Message
Rajesh-451720
Rajesh-451720
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 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
Rajesh-451720
Rajesh-451720
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 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..
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search