Create table sqlite syntax error

205 views Asked by At

Caused by: android.database.sqlite.SQLiteException: near "case": syntax error (code 1):, while compiling

At

CREATE TABLE case ( case_id TEXT PRIMARY KEY, case_body TEXT, case_title TEXT, case_published INTEGER, case_thumbnil TEXT,case_type TEXT );

Can any one please tell me what is the problem, I am testing this on Android 5.0.2

I have checked

Android - SQLite - syntax error (code 1): , while compiling: CREATE TABLE

and this

SQLite syntax error near "CREATE TABLE"

But could not get answer

2

There are 2 answers

0
Giru Bhai On BEST ANSWER

Because you cannot use reserved keywords to name table.

For more info see SQLite Keywords

So you may Change

CREATE TABLE case

to

CREATE TABLE caseTable
0
Hysteria86 On

Is it because CASE is a reserved SQL keyword? Try CREATE TABLE [case]