I want to assign one column's values to another.
here is a query for it.
UPDATE contacts SET contactName=phone;
Here contactName and phone are two different columns.i am assigning phone column's values to contactName column.I can do this by using
db.execSQL(statement);
but if i want it to update it using
db.update(tableName, cValues, whereClause, whereArgs);
what should i put in Content values.If i put phone as a value then it will consider like
UPDATE contacts SET contactName="phone";
Is it possible using content values? Help me to solve this issue. Any help will be appreciated.Thanks in advance
You can't use ContentValues
for that. You can only update/insert literal values with ContentValues
, not column name references.
Just use execSQL()
with the raw SQL you have. (Don't use rawQuery()
- it alone won't execute your SQL.)