Refreshing tables

Last Post 24 Apr 2008 12:12 AM by SQLUSA. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
New Member
New Member

23 Apr 2008 09:17 AM
I have a DTS package that truncates then refreshes my sql tables with approx 2million records in each table. This data is comming from an outside data source(unidata) via an OLEDB connection. Instead of truncating and then completely refreshing the tables each time I run the package, which takes hours, how do I tell the DTS package to look for newly added records only from the source data and then add these records to my SQL tables.

Thank You.
New Member
New Member

24 Apr 2008 12:12 AM
This is the logic you need to work out:

insert into dbo.DestTable (field1, field2,....)
Select SourceTable.field1, SourceTable.field2....)
from SourceTable
where SourceTable.recTimeStamp not in (select
recTimeStamp from DestTable)

Probably best to load everything into a brand new table with no indexes. Do the INSERTs from there.

Kalman Toth - Database, Data Warehouse & Business Intelligence Architect
SQL Server Training, SSAS, SSIS, SSRS:

Acceptable Use Policy