I have a SQLite database which has a table with many rows and columns.
Each row has many columns (100 columns) all with different names.
Other than deleting the complete row and then recreating that row is there a SQL query I can use to clear the data for 1 row only but keeping the first column data and deleting the remaining column data ?
For Example:
Based on my example below, how would I clear row 1 but keep 123 (since that will unique) for this row?
Dim cur As ResultSet
cur = aSQL.ExecQuery("PRAGMA table_info(mytable);")
Do While cur.NextRow
Log(cur.GetString("name"))
Loop
then you can build your update statement in the loop or put the field names in the a map and use dbutils with
B4X:
' updates multiple fields in a record
' in the Fields map the keys are the column names
Public Sub UpdateRecord2(SQL As SQL, TableName As String, Fields As Map, WhereFieldEquals As Map)
Dim cur As ResultSet
cur = aSQL.ExecQuery("PRAGMA table_info(mytable);")
Do While cur.NextRow
Log(cur.GetString("name"))
Loop
then you can build your update statement in the loop or put the field names in the a map and use dbutils with
B4X:
' updates multiple fields in a record
' in the Fields map the keys are the column names
Public Sub UpdateRecord2(SQL As SQL, TableName As String, Fields As Map, WhereFieldEquals As Map)