Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error in update[TCX][MyODBC]Duplicate entry '20020128153002' for key 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I get an error ([TCX][MyODBC]Duplicate entry '20020128153002' for key 1) when trying to do this:

update transactions
set price = 200
where transtime >= '2001-01-01'
and transtime <= '2002-01-27'
and customerid = 'moonwalk';

The table definition is:

create table TRANSACTIONS (
TRANSACTIONID timestamp not null,
CUSTOMERID varchar(15) not null,
USERID int,
TRANSTIME date not null,
PRICE int not null,
SEARCHTYPEID int not null,
GENINVOICEID int,
primary key (TRANSACTIONID));

Thats wrong??

 
Not quite sure, but it may be to do with setting your
Code:
TRANSACTIONID
field as
Code:
not null
. The error indicates that you have a duplicate entry for your timestamp field. Change your table definition, then see if you get the same error.

-Rob
 
Something strange about using timestamp as a primary key. Changed to transactionid varchar(20) and it worked.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top