Here we go. I am accessing the database through an ODBC connection
using the most recent version from Christian's site..

The table schema :

CREATE TABLE invoice_items (
item_id INTEGER PRIMARY KEY,    
invoice_id int4,
product_id int4,
product_name text   ,
sku text   ,
description text   ,
quantity text,
price int4,
cost int4,
taxable bool,
format_price text,
format_total_price text,
taxable2 boolean)

The query :

INSERT INTO invoice_items
(item_id,invoice_id,product_id,product_name,sku,description,quantity,price,cost,taxable,taxable2,format_price,format_total_price)
VALUES (NULL,899,1001975,'HD0001 - ASH - YL','','HOUSE
DIVIDED',1,800,450,'f','f','$8.00','$8.00')

The error :

PRIMARY KEY must be unique (19)

I can't post the database itself because it contains some sensitive
information (as you might have guessed, it's a database of billing
information).

The INSERT query for the invoice_items table has "NULL" hard coded in
for item_id, so I know it's not accidentally being set to an existing
value.


On Nov 20, 2007 4:44 PM,  <[EMAIL PROTECTED]> wrote:
>
> "Mitchell Vincent" <[EMAIL PROTECTED]> wrote:
> > I have a primary key that auto increments and has apparently
> > overlapped back on to itself.
> >
> > INSERT into mytable(id,name) values(NULL,'test');
> >
> > ... is giving me "primary key must be unique" errors.
> >
> > How can I reset the sequence for a primary key? The table only has
> > about 15000 records in it and I've never seen this happen before..
> >
>
> There are over 9e18 keys.  So if you create 1 billion new
> rows per second, continuously, it will take you 262 years to
> exhaust all primary keys.  Since SQLite has only been in
> existance for 7 years, this is clearly impossible so you
> must be doing something wrong.
>
> Perhaps if you provided more details we could help you.
>
> --
> D. Richard Hipp <[EMAIL PROTECTED]>
>
>
>
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
>
>



-- 
- Mitchell Vincent
- K Software - Innovative Software Solutions
- Visit our website and check out our great software!
- http://www.ksoftware.net

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to