Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Constraints Expand / Collapse
Posted Wednesday, June 16, 2010 5:42 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, October 10, 2016 8:24 AM
Points: 46, Visits: 292
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.
Post #938065
Posted Wednesday, June 16, 2010 6:04 AM



Group: General Forum Members
Last Login: Tuesday, November 22, 2016 6:32 AM
Points: 5,519, Visits: 13,287
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

How to post T-SQL questions
Post #938079
Posted Wednesday, June 16, 2010 6:27 AM



Group: General Forum Members
Last Login: Today @ 4:52 AM
Points: 17,172, Visits: 32,134
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
The Scary DBA
Author of:
SQL Server Query Performance Tuning
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #938102
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse