Hi!
You Said me to create the field as "INT PRIMARY KEY NOT NULL" instead of
"INTEGER PRIMARY KEY NOT NULL".Even we spell differently they are working
same.it is also auto incrementing.

sqlite> create table dummytable (recid integer PRIMARY KEY NOT NULL,
label text);
sqlite> insert into dummytable (label) VALUES ('foo');
sqlite> select * from dummytable;
1|foo
sqlite> create table secondtable (recid INT PRIMARY KEY NOT NULL, label
text);
sqlite> insert into secondtable (label) VALUES ('foo');
1|foo
I am not getting any constraint failed error

Regards,
Satish.G

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ian Walters
Sent: Tuesday, November 25, 2008 11:17 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Violating Primary key Constraint

Hi Satish,

I just re-read your original email and Igor's response seemed
appropriate.  The original email read as if you were reporting a problem
rather than asking a question.

As for you question:

sqlite> create table dummytable (recid integer PRIMARY KEY NOT NULL,
label text);
sqlite> insert into dummytable (label) VALUES ('foo');
sqlite> select * from dummytable;
1|foo
sqlite> create table secondtable (recid INT PRIMARY KEY NOT NULL, label
text);
sqlite> insert into secondtable (label) VALUES ('foo');
SQL error: secondtable.recid may not be NULL

--
Ian



Satish wrote:
> Hi Igor!
> 
>     Thanks for the reply.The thing I need is I don't want the field to be
> auto incremented it should show me the error that constraint violated even
> if I give NULL or empty value.how can I do this.Don't send me links which
> doesn't have matter at all.First try to understand the problem and then
give
> me reply.
> 
> Regards,
> Satish.G
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Igor Tandetnik
> Sent: Tuesday, November 25, 2008 10:59 AM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Violating Primary key Constraint
> 
> "Satish" <[EMAIL PROTECTED]> wrote in
> message news:[EMAIL PROTECTED]
>>  I have created a table in sqlite.Upto my knowledge a column which is
>> declared as primary key will not accept null and even if I don't give
>> any value to that field an error occurs that violating the constraint
>>
>> For Example
>>
>> Create table emp(empno integer PRIMARY KEY,...,...)
>>
>> .         Even if I give u a NULL as a value to the field that is
>> declared as primary key .it is accepting
> 
> http://sqlite.org/autoinc.html

_______________________________________________
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

Reply via email to