-1

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

1

2 Answers 2

7

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
Sign up to request clarification or add additional context in comments.

Comments

4

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.