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)
 Importing only latest data

Author  Topic 

VentureFree
Starting Member

19 Posts

Posted - 2008-01-24 : 02:52:36
I've never worked with SSIS before, and I need to figure out how to import only the latest data from an Access table into a SQL Server table. I have a .dtsx file written by someone who no longer works at my company that simply truncates the SQL Server table and copies the entire Access table back into it. This is no longer effective simply because of the amount of data involved (it has become extremely slow over time).

Since each row includes a timestamp, ideally I would look at the latest timestamp in my SQL Server table and retrieve only those rows from Access that have a timestamp later than that. I have no idea how to do this in SSIS.

Logically, I think something like this is called for:
select max(timestamp) as latest from SqlServerTable
store the result in a variable somehow and create a query to
select * from AccessTable where timestamp > [latest]
copying the results of that query into the SQL Server table. How do I do something like that? And if that isn't a feasible way to do it, what way would be better?

Thank you for indulging a newbie.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-24 : 03:05:02
You can declare a new variable for this in package scope. Edit properties of this variable and give Evaluate as expression property to true. Add the above query to expression. Add a parameter to task where this needs to be used and map the parameter to this variable.
Go to Top of Page

VentureFree
Starting Member

19 Posts

Posted - 2008-01-24 : 08:16:24
I found this excellent beginning tutorial on how to do something similar to what I was asking here (it helped me to figure it out, anyway). In case anyone is interested it at http://www.sqlis.com/58.aspx
Go to Top of Page
   

- Advertisement -