[thelist] SQL: finding "new" records in a table

Judah McAuley judah at wiredotter.com
Tue Sep 4 13:02:21 CDT 2007

Luther, Ron wrote:
> Hope it's not as soggy up there as here!

Been sunny and in the mid-80's. I love Oregon summer.

> Sorry, haven't give this a ton of thought. A question and an idea
> though.
> Question - How are you handling cancelled appointments?  Are you
> receiving a blank record for that timeslot?  Just wondering how you know
> to delete an existing appointment in the absence of an 'update' record.

The exported data, thankfully, has an is_canceled flag.

> Idea - How about a 'delsert' methodology?  If your csv files are
> complete appointment records for each individual office then, upon
> receipt, you can delete all records for that office and insert all of
> the new records.  Probably faster than any search & update rigamarole.
> Would handle cancellations as well.  Might wanna save off a prior gen
> (or use one of those 'deleted' flags or timestamps with an out-of-cycle
> cleanup process) to allow you to revert data if you get a "short" file
> from some office some day.

Unfortunately, our system does additional lookups and adds new data to 
the appointment as it goes into our db. Consequently, the data isn't 
*exactly* the same so I can't do a delsert strategy. Good ideas though, 
thanks for tossing them out there.


More information about the thelist mailing list