On 17/03/2009 12:33 AM, P Kishor wrote: > On Mon, Mar 16, 2009 at 8:31 AM, P Kishor <[email protected]> wrote: >> is there a way to have a table start the INTEGER PRIMARY KEY sequence >> at 0 (or some other arbitrary number)? >> >> -- >> Puneet Kishor >> > > I should have added.. yes, I can do the following > > CREATE TABLE foo (a INTEGER PRIMARY KEY, b TEXT); > INSERT INTO foo VALUES (0, 'blah'); > > but, I want to do > > INSERT INTO foo (b) VALUES ('blah'); > > additionally, are their any gotchas with forcing INTEGER PRIMARY KEY > (hence, the ROWID) to start from 0? > > Hi Puneet,
Have you read this: http://www.sqlite.org/autoinc.html ? The first part appears to cover non-autoincrement as a background to explaining the subtle differences with auto increment. It appears that you will need to write the first ROWID explicitly. There may be a gotcha with zero, otherwise why pick 1 for the default? What are you trying to achieve? If you are going to let the software choose your PK for you, why do you care what the starting value is? Cheers, John _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

