r/DatabaseHelp • u/Bluhb_ • Sep 24 '20
Reinserting every row of table
Hello,
I'm building an application that will store it's settings in a DB. Now I'm looking at changing these settings. From the menu where you can change the settings I get all settings when they are applied. My plan was to just drop the settings table (or delete every row, what's better?) and then recreate the table with the new settings.
Is dropping and recreating a table considered bad practice? Because it sure feels like it. Is there any other(better) way to do something like this?
Kind regards and thanks in advance!
Bluhb_
2
Upvotes
View all comments
Show parent comment
1
u/phunkygeeza Sep 24 '20
It sounds like you need to do some databases 101. It'll pay you back I promise!
Rows are identified by keys. You don't have to go through rows looking for the right one, you simply write a query that addresses the row you need based on a key.
Settings tables are often a simple Name Value pair. Your setting name is your key, you might even keep a reference to the ID of the control on your form and find your row that.