Is there a way to get an autoincrement field without being a primary key? -------------------- J. R. Westmoreland E-mail: j...@jrw.org
-----Original Message----- From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik Sent: Friday, January 23, 2009 1:01 PM To: sqlite-users@sqlite.org Subject: Re: [sqlite] Is this a bug? J. R. Westmoreland <j...@jrw.org> wrote: > I have the following table creation statements and get an error. > > Functioning statement > > CREATE TABLE xxx (ID INTEGERPRIMARY KEY AUTOINCREMENT, .) > > If I remove the PRIMARY KEY" part of the statement, according to the > docs on SQL that should be still a valid statement, I get an error. > > Brken statement: > > CREATE TABLE zzz (ID INTEGER AUTOINCREMENT .); SQLite only supports AUTOINCREMENT together with PRIMARY KEY. See http://sqlite.org/lang_createtable.html > But, if I change "AUTOINCREMENT "AUTO_INCREMENT" it works > > Functioning statement: > > CREATE TABLE zzz (ID INTEGER AUTO_INCREMENT .); AUTO_INCREMENT has no special meaning in the syntax. It works for the same reason this works: CREATE TABLE zzz (ID WHATEVER I WANT); Neither makes ID an autoincrement field. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users