Sqlite Query Error

I am using sqlite db in android. In this I need to give Id as autoincrement and second 'Incoming_sms' field as primary key. but it shows me error as below:

detailMessage "near "AUTOINCREMENT": syntax error:  
CREATE TABLE TwoWayTable111 (
  ID INTEGER AUTOINCREMENT,  
  INCONMING_MSG TEXT PRIMARY KEY,  
  OUTGOING_MSG TEXT,  
  STATUS TEXT )" 

Why does this error occur? But when I give id as autoincrement and primary key, it works fine.

Answers


This is a FAQ. It works as designed. This statement returns a syntax error.

create table test (id integer autoincrement);

This one runs without error.

create table test (id integer primary key autoincrement);

You should be able to do this.

CREATE TABLE TwoWayTable111 (
    ID INTEGER PRIMARY KEY, 
    INCONMING_MSG TEXT NOT NULL UNIQUE, 
    OUTGOING_MSG TEXT, 
    STATUS TEXT );

Need Your Help

Display original image using fancybox

javascript jquery fancybox lightbox fancybox-2

I want to display the original image in the popup using fancybox but it doesn't seems to be working. Instead it is resizing the width and height of image and container.

How can I list all postgres rules using SQL?

sql postgresql rule

I have a postgres DB with SQL-only access (I mean I can connect using psql). I need to disable some rules, do maintenance and then enable them back. I'd like to assure that after all those operatio...