Hi...!
 
I am developing with SQLite in these days but I am having problem creating 
auto_increment ID.
I looked at FAQ section, but I couldn't find the solution.
I am using sqlite 3.08 at the moment.
 
Here is the sample statement:
 
sqlite>create table fruits (id int primary key, name varchar(50));
sqlite>create table temp (id int primary key, type int, name varchar(50));
sqlite>insert into temp values (1, 0, 'apple');
sqlite>insert into temp values (2, 0, 'orange');
sqlite>insert into temp values (3, 1, 'potato');
sqlite>insert into temp values (4, 1, 'onion');
sqlite>insert into temp values (5, 0, 'banana');
 
I want to insert the rows whose type is fruits(=1) in kinds of temp table into 
fruits table.
 
sqlite>insert into fruits select ifnull((select max(id) from fruits), 0)+1, 
name from temp where type = 1;
 
If I query then error message window is opened in the statement
 
Here is the error message :
================================================================================================================
Assertion faild!
 
Program: C:\SQLite\sqlite3.exe
File: C:\SQLite\source\vdbe.c
Line: 2817
 
Expression: p->apCsr[i]!=0
 
For information on how your program can cause an assertion fauilure, see the 
Visual C++ documentation on asserts
...
================================================================================================================
 
How could I query without error ?
 
Yours Faithfully
 
Hyun-Keun,Park
 

Reply via email to