pk issue

  • I'm working with a table with two primary keys (ID, Product_code). When I update product_code to a different value and try to insert a new record with the same primary key combination as the record had before the update I'm getting a pk duplication error. Is there some reason that the table would retain that primary key combination even after updating.

    Example:

    update Subscriptions set Product_Code = 'annual' where ID = 221226 and product_code = 'rm'

    insert into subscriptions (product_code, ID) values ('rm',221226)

    the insert will return pk error. What am I missing.

  • Try to add GO between your two commands.;)

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

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