[thelist] SQL: finding "new" records in a table
Judah McAuley
judah at wiredotter.com
Tue Sep 4 11:09:26 CDT 2007
I have a DTS package in SQL Server 2000 that dumps all the appointments
that are scheduled for now or in the future. It runs every hour. This
means that if an appointment is a week from now, it is going to be
included in 168 data dumps from now until the appointment actually
happens. This is obviously wasteful.
It would be relatively easy to read in the csv file for the last data
dump into a temp table and then do a join from the appointments table to
the temp table and grab the ones that exist in one table but not the other.
However, this appointments table is the canonical data source and
sometimes information about the appointment may change. The date,
location, which doctor its with, etc. The appointment id is going to be
the same, but some attribute will have changed and that will qualify it
as a "new" row because the changes have to be propagated.
There isn't anything like an Is_changed flag on the appointments table
and I don't have the option of modifying the table structure or the
process that adds/updates appointments.
Any thoughts on the most efficient and logical way to only dump new or
changed appointments?
Thanks,
Judah
More information about the thelist
mailing list