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
Author
Message
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, September 8, 2014 3:14 AM
Points: 43, Visits: 233
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


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 7:42 AM
Points: 4,417, Visits: 10,718
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
spaghettidba.com
@spaghettidba
Post #938079
Posted Wednesday, June 16, 2010 6:27 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:53 AM
Points: 13,890, Visits: 28,285
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 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

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

Add to briefcase

Permissions Expand / Collapse