dbTalk Databases Forums  

Global Variables in DTS

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Global Variables in DTS in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Terry Hannon
 
Posts: n/a

Default Global Variables in DTS - 01-28-2004 , 04:32 PM






Hi Everyone,

I am pretty new to DTS and am trying to setup a global variable.

Basically I want to do the following:

1) Select Max(date) from table into global variable
2) Use global variable in the SQL portion of my transform data task to only
select rows that have a date greater than my global variable.

This does not seem hard, but when I look into the Books online it tells me
to use a ExecuteSQLTask2 object, but I cannot seem to find it anywhere in
the design window. I am running SQL Server 2000, and cannot figure out how
to use a ExecuteSQLTask2 object.

Any help would be very much appreciated.

Thanks
Terry Hannon



Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Global Variables in DTS - 01-28-2004 , 04:54 PM






Ahhhh

I presume that because you are using > MAX that the MAX is coming from a
different table? Different server?

OK

Non DTS specific would be

SELECT ..FROM TABLE WHERE DateCol > (SELECT MAX(DateCol) FROM OtherTable)


DTS Would look like

How to Use Lookups in DTS
(http://www.sqldts.com/default.aspx?277,1)


You could assign the value as an Output Global Variable in one ExecuteSQL
task and assign it in the datapump

SELECT MAX(DateCol) FROM Table


Then

SELECT .. FROM TABLE WHERE DateCol > ?

you then map the parameter to the GV





--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Terry Hannon" <thannon (AT) terryhannon (DOT) com> wrote

Quote:
Hi Everyone,

I am pretty new to DTS and am trying to setup a global variable.

Basically I want to do the following:

1) Select Max(date) from table into global variable
2) Use global variable in the SQL portion of my transform data task to
only
select rows that have a date greater than my global variable.

This does not seem hard, but when I look into the Books online it tells me
to use a ExecuteSQLTask2 object, but I cannot seem to find it anywhere in
the design window. I am running SQL Server 2000, and cannot figure out
how
to use a ExecuteSQLTask2 object.

Any help would be very much appreciated.

Thanks
Terry Hannon





Reply With Quote
  #3  
Old   
Terry Hannon
 
Posts: n/a

Default Re: Global Variables in DTS - 01-28-2004 , 05:37 PM



Thanks Allan,

I finally got it to work.

Terry Hannon

"Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> wrote

Quote:
Ahhhh

I presume that because you are using > MAX that the MAX is coming from a
different table? Different server?

OK

Non DTS specific would be

SELECT ..FROM TABLE WHERE DateCol > (SELECT MAX(DateCol) FROM OtherTable)


DTS Would look like

How to Use Lookups in DTS
(http://www.sqldts.com/default.aspx?277,1)


You could assign the value as an Output Global Variable in one ExecuteSQL
task and assign it in the datapump

SELECT MAX(DateCol) FROM Table


Then

SELECT .. FROM TABLE WHERE DateCol > ?

you then map the parameter to the GV





--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.allisonmitchell.com - Expert SQL Server Consultancy.
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


"Terry Hannon" <thannon (AT) terryhannon (DOT) com> wrote in message
news:%23ZNoS6e5DHA.1804 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Hi Everyone,

I am pretty new to DTS and am trying to setup a global variable.

Basically I want to do the following:

1) Select Max(date) from table into global variable
2) Use global variable in the SQL portion of my transform data task to
only
select rows that have a date greater than my global variable.

This does not seem hard, but when I look into the Books online it tells
me
to use a ExecuteSQLTask2 object, but I cannot seem to find it anywhere
in
the design window. I am running SQL Server 2000, and cannot figure out
how
to use a ExecuteSQLTask2 object.

Any help would be very much appreciated.

Thanks
Terry Hannon







Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.