October 19, 2009 at 3:36 pm
Newbie question...
Our home office overwrites a table every night with new data. I want to know when a new row appears in the table, but if they overwrite the data, how can I do this? The only thing I can think of is copy the table each evening before they overwrite it, and compare the new data with my copy. Is there any easier way?
TIA for the help!
October 19, 2009 at 3:44 pm
Hi
I believe if I'm understanding your question adding another column to the table and making the default value of that column as "getdate()" this will give you the exact time that row was added or changed.
October 19, 2009 at 3:51 pm
Thanks so much for the quick reply!
Unfortunately I cannot change the table; our home office has complete control over this table. Every night they delete the current contents of the table and loads new data. It "should" be the same customer base, however once in awhile a new customer is added. So the only way I can think of doing it is to copy the table daily, when the new data is loaded the next day, do a left join and see if anything is new.
Any other ideas?
October 19, 2009 at 10:50 pm
Shairal-763732 (10/19/2009)
Newbie question...Our home office overwrites a table every night with new data. I want to know when a new row appears in the table, but if they overwrite the data, how can I do this? The only thing I can think of is copy the table each evening before they overwrite it, and compare the new data with my copy. Is there any easier way?
TIA for the help!
You only need the PK from the table to compare with but you have the correct idea. Properly indexed, it will be very fast. And, if you use SELECT/INTO to create the new "master", that will be very fast as well. That will also allow you to determine if they've deleted rows, as well.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply