Is there any query available to update only first n records of SQLite DB ..?
The previous answer assumes that the primary key identifier is starting at 1. This would not be the case if rows have been deleted.
http://www.sqlite.org/lang_update.html states: "If SQLite is built with the SQLITE_ENABLE_UPDATE_DELETE_LIMIT compile-time option then the syntax of the UPDATE statement is extended with optional ORDER BY and LIMIT clauses..."
In this case, you can use this simple query:
UPDATE table SET columns = 'value' WHERE 1 LIMIT n ORDER BY identifier ASC
The other clause might not be needed based on the default ordering scheme.
If you are using a sequential int identifier, UPDATE table SET columns = 'value' WHERE identifier <= n
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With