Hi, Is there any querry available to update only first n records of SQLite DB ..?
A:
If you are using a sequential int identifier, UPDATE table SET columns = 'value' WHERE identifier <= n
Jordan S. Jones
2009-07-20 04:25:36
+5
A:
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.
raidfive
2009-07-20 04:35:18