Thanks for your anwser.
On 5/19/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
PY <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have a problem about the ROWID.
>
> I want to create a table with unique value, not only [id] but also
[name],
> and the table named [foo]
> CREATE TABLE foo (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT
UNIQUE);
>
> I don't want to select the table for avoiding the duplicate NAME
problem.
> So, I use the "IGNORE" when I insert into the table.
>
> INSERT OR IGNORE INTO foo (name) VALUES ('x');
> INSERT OR IGNORE INTO foo (name) VALUES ('x');
> INSERT OR IGNORE INTO foo (name) VALUES ('x');
> INSERT OR IGNORE INTO foo (name) VALUES ('x');
> INSERT OR IGNORE INTO foo (name) VALUES ('y');
>
> After that I found a phenomenon, when I select the table, the result
listed
> below.
>
> SELECT * FORM foo;
>
> id name
> ---------- ----------
> 1 x
> 5 y
>
>
>
> My expected value of y is 2 not 5.
>
>
> The squence of the id is important to us. How to resolve this problem?
> Thanks for your grest help.
>
Try using INSERT OR FAIL instead of of INSERT OR IGNORE.
--
D. Richard Hipp <[EMAIL PROTECTED]>