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 2005 Forums
 SSIS and Import/Export (2005)
 How to filter data based on the table value?

Author  Topic 

sqlval
Starting Member

12 Posts

Posted - 2011-05-02 : 16:05:06
I have a set of data coming from Oracle DB into SQL server. There is a table in SQL Server that stores key dates that should be used to filter data that comes from Oracle. Basically, I want to load only the records that were updated in Oracle after a particular date stored in SQL Server. Is it doable?
Thank you in advance for your ideas.

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-05-02 : 16:18:31
Yes - can use ssis or a linked server. Just create the extract query using the date.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sqlval
Starting Member

12 Posts

Posted - 2011-05-02 : 16:21:27
I need to use SSIS. How do I create an extract query for Oracle DB using a date stored in SQL Server DB? What task can be used for that?
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-05-02 : 16:37:21
It's a data flow. I usually make the query based on a variable and set te variable before the task runs.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sqlval
Starting Member

12 Posts

Posted - 2011-05-02 : 16:43:00
Oh, it's getting to the point :). Do you create a variable that stores the result from one query? And then? You use this variable in the SQL Source task? How do you pass it?
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2011-05-02 : 16:51:01
No - I mean a variable to hold the query text. The result of the query would be insrted into a sql server table (I take it that is where you want the data to end up).

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sqlval
Starting Member

12 Posts

Posted - 2011-05-02 : 17:07:02
Thank you for helping me with it.
Yes, you are correct, the final result will be inserted into SQL Server DB. My issue is that I need to create a query for Oracle that will have a parameter from SQL Server in the WHERE clause. This parameter is changing, so it should also be a variable, I guess?
Should I create Execute SQL Tasks to create both variables? And then, how do I call the query text from the variable?
Go to Top of Page

sqlval
Starting Member

12 Posts

Posted - 2011-05-02 : 17:13:23
I think I got it. Thank you very much for an idea!
Go to Top of Page
   

- Advertisement -