May 20, 2002 at 9:51 am
I have a DTS Package updating Table A everyday. I need to be able to query Table B for a certain record and if it exists update Table B with the new values from Table A and if it does not exist insert record into Table B from Table A. Table size is around 5000 records. What is the most efficient way to achieve this?
Thanks
Chris
</cm>
May 20, 2002 at 9:56 am
Do you have some knowledge of what new stuff goes into Table A?
Actually it doesn't matter. Do an update join on the tables using the PK. Anything that matches will update from A. If you can limit by datetime for some other item, it reduces the server work, but may not matter.
Then insert anything that doesn't exist. Not a great query, but it works.
Steve Jones
May 20, 2002 at 10:16 am
Thanks,
table a is a product table that is maintained in our legacy system and then imported into sql. any of the data could be modified. i definitely will need a date stamp for last modified to prevent heavy processing. thanks again
</cm>
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply