![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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 |
#3
| |||
| |||
|
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
| |