Editing database Fields - Help Needed

  • I have a simple problem here, can anyone help me to solve this?

    I want to update some fields in a Table called " HOLDING" which is having values "Holding_Id", "Holding_Key", "Holding_Time".....so on...

    when i use update command to update filed sql gives me error like: [MICROSOFT][ODBC SQL Server Driver] [SQL SERVER] Violation of Primery Key Constraint "PK_Holding" Canot insert Duplicate key in the Object "Holding"

    please help me to solve this...

    Thanx in advance


    Kindest Regards,

    Navin Shetty
    naveenshetty.cjb.net

  • It means just that.  You are trying to insert a value that already exists in the primary key.

     

    Can you post the code you are using so that we can show you how to make it work?

  • Look for the primary key field in the table designer. It should be marked with a key field. Or check the indexes and look for the PK. Or if you are setting a PK, use those fields.

    Now you can check for dups with a

    select PrimaryKeyField

    , count(*)

    from MyTable

    group by PrimaryKeyField

    having count(*) > 1

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply