Sqlite and column reset

Just starting out? Need help? Post your questions and find answers here.
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Sqlite and column reset

Post by jak64 »

Good morning,
Is there a quick way to reset all values of a column in a Sqlite table?

Thank you for your help
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Sqlite and column reset

Post by Kiffi »

Code: Select all

UPDATE YourTable SET YourColumn = YourValue
Hygge
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Sqlite and column reset

Post by jak64 »

Hello Kiffi,

Thank you for your answer.


So I don't need to do a select * and read each record to do update?
User avatar
Kiffi
Addict
Addict
Posts: 1353
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: Sqlite and column reset

Post by Kiffi »

You can run the update-statement directly on the database with DatabaseUpdate(). The missing "Where"-clause causes all values of the column to be changed in one step.
Hygge
jak64
Enthusiast
Enthusiast
Posts: 502
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Sqlite and column reset

Post by jak64 »

OK thank you
Post Reply