Synchronizing set with SQL table
Posted: Thu Dec 30, 2010 1:17 pm
Hello there. I have an array which I need to synchronize with SQL table.
The table has two columns - id and text. I need to remove old values from the table and insert new. Don't need updating.
My current sequence:
1) Remove rows which aren't present in the current array
2) Get current table records
3) Go through current records and insert new values
Other way is more simple:
1) Remove all rows
2) Insert array items
Which one is more efficient? Or there is better way?
The table has two columns - id and text. I need to remove old values from the table and insert new. Don't need updating.
My current sequence:
1) Remove rows which aren't present in the current array
2) Get current table records
3) Go through current records and insert new values
Other way is more simple:
1) Remove all rows
2) Insert array items
Which one is more efficient? Or there is better way?