I have fully functional code that takes data in a range on an Excel sheet and ADDS NEW ROWS to a SQL database.
I am now faced with the need to UPDATE EXISTING ROWS instead of just adding new rows.
I think it will be best to DELETE ALL EXISTING ROWS matching the criteria then ADD NEW again.
My concern is, if I only update the rows listed in the table there could be an instance where there were 10 rows matching the criteria in the table but only 9 are required after the update. Better to delete 10 and add 9 than end up with a row of leftover old data; 9 new and 1 old. If I’m wrong, please advise.
My knowledge of SQL is minimal but I need to delete this:
Select * FROM TABLE_NAME Where DOC_ID = “123456”
(DOC_ID is a field linked to another table NOT a primary key/unique ID in this table.)
This is what I have preceding the ADD ROWS code where I think I should first DELETE ROWS
Bookmarks