Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
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: Friday, September 18, 2015 8:36 AM
Points: 43, Visits: 236
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: Friday, October 2, 2015 10:28 AM
Points: 5,230, Visits: 12,367
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 @ 11:07 AM
Points: 15,917, Visits: 30,201
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