tags:

views:

2575

answers:

3

I am using sqlite with python 2.5. I get a sqlite error with the syntax below. I looked around and saw AUTOINCREMENT on this page http://www.sqlite.org/syntaxdiagrams.html#column-constraint but that did not work either. Without AUTO_INCREMENT my table can be created.

An error occurred: near "AUTO_INCREMENT": syntax error 
CREATE TABLE fileInfo
(
fileId int NOT NULL AUTO_INCREMENT,
name varchar(255),
status int NOT NULL,
PRIMARY KEY (fileId)
);
+4  A: 

This is addressed in the SQLite FAQ. Question #1.

Sean Bright
I like this type of answers. You should compress it to RTFM :)
lmsasu
+1  A: 

It looks like AUTO_INCREMENT should be AUTOINCREMENT see http://www.sqlite.org/syntaxdiagrams.html#column-constraint

Andrew Cox
+2  A: 

You could try

CREATE TABLE fileInfo
(
fileid INTEGER PRIMARY KEY AUTOINCREMENT,
name STRING,
status INTEGER NOT NULL
);
Jack