What is the best SQL server practice for editing a document that affects multiple tables/rows?
Posted on 2014-03-02
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!