how to use ssis to pull and keep data in sync between SQL server 2008 and Postgres 8.3

I am trying to pull data from a PostgreSQL 8.3 database. I can successfully pull data from the tables and write them into my SQL server tables. My problem is that I don't want to just sync everything. I want to get the max(id) from my local SQL server table, then get everything > max(id) from the postgres remote table. I used a web article create an ADO.net connection to my postgres db. However I can't find a place in the ADO.net source where I can use a variable in my where clause.

What I am doing is: SELECT * FROM tblFiles in my ADO.net editor. I would like to do something like SELECT * FROM tblFiles WHERE id > cast(? as int)

Can anybody help or does anybody have a better way of doing this? All I need to do is insert the rows that exist in the remote server to my local server.
LVL 1
sqlagent007Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vdr1620Commented:
I am afraid, you can't do that..

The best way to do it is get all the data from Postgre Table , Use a lookup in the SQL table and compare the existing data using the Max(id) and Insert only the required data into the SQL table..

ADO.NET Source ---> Lookup (to get Max Id from SQL Table) ----> OLE DB source (Insert new data)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sqlagent007Author Commented:
Thanks, I think I will create a small table on the postgres side, then update that table with my SQL tables maxID, and then put a sub query in the ado.net object to filter on ID > (select max(id) from NewPostresTable).
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.