Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Assign MAX(date) to Globale variables

Author  Topic 

ducepair
Starting Member

7 Posts

Posted - 2009-08-24 : 18:11:27
Hi all, i have a question regarding assign a value to Global variable. I defined a Global variable and i want to set the value as max load date of target table.

To explain more clear

I have a source called TableA in DB2 data base and i have target table called TableB in Oracle. And i am using DTS package to transfer data.

Table A
Col1 Varchar2(10)
Col2 Dat2
Col3 Clob
Here is my target
TableB
Col1 Varchar2(10)
Col2 Dat2
Col3 Clob

Now while running the DTS package the global variable should capture max(col2) from TableB and load data greater than last run date.
Can someone tell me how to do this scenario? I am trying to do this
Declare
@start_date date;
select @start_date = select max(col2) from TableB;
SELECT col1,clo2,clo3 FROM TableA WHERE col2 > @start_Date
When I parse the SQL it was successful. But in the transformations tab, I did not find my source columns.
Then I tried this
SELECT col1,clo2,clo3 FROM TableA WHERE col2 > ?
Then I mapped the parameter to Global variable date1. That did not work because of the following error. STRING DATA RIGHT TRUNCATION.

I really appreciate your help and comments.

Thanks

   

- Advertisement -