Entering duplicates in a Primary Key column

  • I have a table with the fields acct_id,program_id and a datestamp. Both the acct_id and program_id are primary keys.

    An acct_id can have a different program_id in different years. So there are some duplicate acct_ids with different program_ids, depending on the year. An acct_id cannot have the same program_id duplicated in the same year.

    When I try to make new insertions, I get this error message :

     Violation of PRIMARY KEY constraint 'PK_tableName. Cannot insert duplicate key in object 'tableName'. The statement has been terminated.

    How can I make insertion into this table?

  • Add year to PRIMARY KEY.

    _____________
    Code for TallyGenerator

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

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