Search
 
SCRIPT & CODE EXAMPLE
 

SQL

android sqlite add column if not exists

Cursor cursor = database.rawQuery("SELECT * FROM MY_TABLE", null); // grab cursor for all data
int deleteStateColumnIndex = cursor.getColumnIndex("MISSING_COLUMN");  // see if the column is there
if (deleteStateColumnIndex < 0) { 
    // missing_column not there - add it
    database.execSQL("ALTER TABLE MY_TABLE ADD COLUMN MISSING_COLUMN int null;");
}
Comment

PREVIOUS NEXT
Code Example
Sql :: constraints to columns SQL 
Sql :: oracle login as sysdba 
Sql :: mysql get last inserted id 
Sql :: show database cmd 
Sql :: return result of function in postgresql 
Sql :: drop sequence 
Sql :: sql update insert and delete 
Sql :: mysql group by date 
Sql :: avg sql 
Sql :: import sql in postgresql 
Sql :: postgre alter table foreign key 
Sql :: between from sql 
Sql :: PostgreSQL types and C# types 
Sql :: enable foreign key checks postgres 
Sql :: sql value exists in column 
Sql :: sql order by multiple columns 
Sql :: show sql server database 
Sql :: sql server select last row of each item in group by column 
Sql :: power bi dax is in the last 3 months 
Sql :: WHERE not regex in SQL 
Sql :: mysql set boolean default value 
Sql :: datediff in sql 
Sql :: open postgresql.conf 
Sql :: make date with time sql 
Sql :: oracle current session details 
Sql :: oracle change tablespace size 
Sql :: sql select if not exists 
Sql :: sql create table with data 
Sql :: oracle right characters 
Sql :: sql String comparisons case sensitive 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =