select max(item_id) from invoice_items;

Produces "803" - but that is pretty clearly wrong when I look at the
dataset a count() returns 15503 records in that table.

min(item_id) is 1 (as expected).

I can insert records if I specify a unique item_id.


On Nov 20, 2007 5:50 PM, Dennis Cote <[EMAIL PROTECTED]> wrote:
>
> Mitchell Vincent wrote:
> > 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.
> >
> >
> >
> Can you select the max and min item_id values form the database and
> report them back here.
>
> Can you then change your code to insert a new dummy record with an
> item_id that is set to one greater than the maximum value, rather than
> your hard coded NULL value. I just want to see if you can insert a
> properly formed record into your database at all. You should then delete
> that record so it doesn't cause a problem in your database later.
>
> Dennis Cote
>
>
>
> -----------------------------------------------------------------------------
> 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