Re: [sqlite] auto_increment and not null

2007-06-28 Thread Bruno S. Oliveira
Thanks Andrew and everyone. I'll see what I can get with it. Thanks for your attention, Bruno On 6/28/07, Andrew Finkenstadt <[EMAIL PROTECTED]> wrote: On 6/28/07, Bruno S. Oliveira <[EMAIL PROTECTED]> wrote: > > Hi all, > > Now I see the what's happening. > But what if I need to create a

Re: [sqlite] auto_increment and not null

2007-06-28 Thread Andrew Finkenstadt
On 6/28/07, Bruno S. Oliveira <[EMAIL PROTECTED]> wrote: Hi all, Now I see the what's happening. But what if I need to create a table with two primary keys and one auto incremented (and I DO need that!)? Isn't this possible? If by primary key you mean alternate (unique) key, then yes.

Re: [sqlite] auto_increment and not null

2007-06-28 Thread Bruno S. Oliveira
Hi all, Now I see the what's happening. But what if I need to create a table with two primary keys and one auto incremented (and I DO need that!)? Isn't this possible? Thanks a lot Trevor and all. Thanks for the attention. Best regards, Bruno On 6/28/07, Trevor Talbot <[EMAIL PROTECTED]>

Re: [sqlite] auto_increment and not null

2007-06-28 Thread Trevor Talbot
To add the guarantee that automatically generated values will never be reused, your only option is: create table foo(id integer primary key autoincrement); Got involved testing this and forgot what I originally went to look for. You can add "not null" on the end of that, if you want.

Re: [sqlite] auto_increment and not null

2007-06-28 Thread Trevor Talbot
On 6/28/07, Bruno S. Oliveira <[EMAIL PROTECTED]> wrote: CREATE TABLE te_representation (repres_id INTEGER AUTO_INCREMENT NOT NULL ,layer_id INTEGER ,geom_type INTEGER ,geom_table TEXT ,description TEXT ,lower_x REAL ,lower_y REAL ,upper_x REAL ,upper_y REAL ,res_x REAL ,res_y REAL

Re: [sqlite] auto_increment and not null

2007-06-28 Thread Bruno S. Oliveira
Hi, On 6/28/07, Trevor Talbot <[EMAIL PROTECTED]> wrote: "integer primary key" is special, and the only column "autoincrement" can be applied to. It's not a general-purpose sequence option, like some other database engines. Yep, I knew that. The problem is that, with a table created like

Re: [sqlite] auto_increment and not null

2007-06-28 Thread Trevor Talbot
On 6/28/07, Bruno S. Oliveira <[EMAIL PROTECTED]> wrote: Does the sqlite auto_increment work only with primary keys WITHOUT the not null constraint? The same query on the same table worked on MySQL. "integer primary key" is special, and the only column "autoincrement" can be applied to. It's

Re: [sqlite] auto_increment and not null

2007-06-28 Thread Bruno S. Oliveira
Hi Griggs and everyone, Nop, the problem isn't the underscore. The sqlite works with both keywords: AUTOINCREMENT and AUTO_INCREMENT. Thanks for the attention! Regards, Bruno On 6/28/07, Griggs, Donald <[EMAIL PROTECTED]> wrote: Regarding: "I'm aware of the create table syntax. And

RE: [sqlite] auto_increment and not null

2007-06-28 Thread Griggs, Donald
Regarding: "I'm aware of the create table syntax. And according to it I can declare a column as INTEGER AUTO_INCREMENT NOT NULL. So I wonder why this doesn't work (in MySQL it does!)." To underscore -- the difficulty: Maybe it was just a typing mistake in your message, but according to

Re: [sqlite] auto_increment and not null

2007-06-28 Thread Bruno S. Oliveira
Hi Eugene and all, On 6/28/07, Eugene Wee <[EMAIL PROTECTED]> wrote: Why not declare repres_id as INTEGER PRIMARY KEY? You can refer to the documentation on CREATE TABLE: Well, I am declaring it as INTEGER PRIMARY KEY. Or do you mean without the NOT NULL and AUTO_INCREMENT? I'm aware of the

Re: [sqlite] auto_increment and not null

2007-06-28 Thread Eugene Wee
Hi Bruno, Why not declare repres_id as INTEGER PRIMARY KEY? You can refer to the documentation on CREATE TABLE: http://www.sqlite.org/lang_createtable.html Regards, Eugene Wee Bruno S. Oliveira wrote: Hi all, I'm having some trouble in inserting data into a table which its primary key is