What is the best SQL server practice for editing a document that affects multiple tables/rows?

lthames
lthames used Ask the Experts™
on
Hi,

I have an application in VB6 that is being migrated from dBAse IV to SQL Server 2008 R2 database.  There are several 'documents' that are organized into a header table and detail table where the detail table has multiple records.  

When the 'document' is edited,  some of the rows from the detail could have been deleted, some added, or some just changed.

What is the best practice for doing this type of work?

1 - update each record based on the record's unique key and then delete any record that isn't in the document anymore?

2 - delete all records and re-insert only the rows in the document?

Thanks for your input!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2012
Commented:
2.  Is a lot easier to accomplish.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial