Constraints

  • Hi All,

    I am using a table which has got a LocationID for a location with primary key constraint.

    Now I have another record for same location and I want to add that one on.

    Just to keep it clear this LocationID is getting used in different other databases as well and every night there is data coming into the database update records in different tables and Ialso don't want to drop the constraint.

    so actually what I want to do is add to LocationID's for the same place. How can I get around it.

    Thanks very much.

  • Drop the primary key, or add to it all the fields that actually make up the key, if this applies.

    Is there a better primary key fo that table?

    -- Gianluca Sartori

  • If you need to maintain artificial keys between multiple databases I'd suggest one of two approaches, each of which has strengths & weaknesses. First, set up an ID service that maintains the ID for all the various incarnations of LocationID in a central point. That means that all databases/apps go to this service to get the ID. The other option would be to use globally unique identifiers. This would enable each database/app to create it's own LocationID on the fly and not worry about interfering with any other.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

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

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