### Foreign key to composite key

that makes up the composite key. This is what most of the detail tables do. Otherwise I have to make the OrderNo a foreign key ...
| 8 Replies | 10683 Views | Created by jinzuya - Monday, November 15, 2010 9:51 PM | Last reply by afrodita_ust - Thursday, November 17, 2011 2:54 PM

### referencing foreign keys from composite primary keys

] GO I think you need to have both the columns to create foreign key constraint on composite primary key. In other ...
| 4 Replies | 3622 Views | Created by slickk_F - Monday, February 11, 2013 11:42 AM | Last reply by Kalman Toth - Wednesday, February 13, 2013 7:53 PM

### Foreign Key / Composite Key Question

How can I create a FK relationship on one column of composite key to one column of a composite key in another table?
| 3 Replies | 4302 Views | Created by Corey Furman - Tuesday, July 29, 2008 8:23 PM | Last reply by Cristian Mandragiu - Tuesday, July 29, 2008 8:42 PM

### confused about foreign keys to a composite primary key

be able to capture all this information in three tables but I am having to create a fourth redundant table because I can’t figure out how create a foreign ...
| 5 Replies | 3877 Views | Created by hankeye - Tuesday, March 10, 2009 7:44 PM | Last reply by Adam Haines - Wednesday, March 11, 2009 9:04 PM

### getting composite foreign keys

Best to use the surrogate INT IDENTITY(1,1) PRIMARY KEY in most cases. That way you cannot have "composite" foreign key, hence the problem goes ...
| 5 Replies | 4109 Views | Created by Mehmood Ahmed - Friday, April 30, 2010 9:51 AM | Last reply by Kalman Toth - Wednesday, May 5, 2010 2:10 PM

### foreign key to reference composite primary key

up being a bust.) If this can't be done, so be it.  But is there no way to give a constant as one of the parameters to a forein key referencing a composite ...
| 4 Replies | 6498 Views | Created by ._Michael_. _ - Friday, October 15, 2010 4:46 PM | Last reply by ._Michael_. _ - Friday, October 15, 2010 6:24 PM

### Using Composite Primary key of weak entity as Foreign key.

If I understand you question correctly, the answer is yes.  A composite foreign key can reference the composite primary ...
| 2 Replies | 764 Views | Created by Emy Amidis - Friday, April 18, 2014 2:11 PM | Last reply by Dan Guzman - Friday, April 18, 2014 2:44 PM

### Foreign And Composite Keys

hi, thanks. yes, owner_userID is unique but I need to keep my PK in UserPrecedence as a composite key on (up_order, owner_userID). The foreign ...
| 6 Replies | 4966 Views | Created by pbd22 - Monday, July 30, 2007 5:17 PM | Last reply by Kent Waldrop _ - Monday, July 30, 2007 5:33 PM

### Composite Primary Key and Foreign Key... can they be the same?

) REFERENCES [Account].[UserGroup](Id) ALTER TABLE [Account].[UserGroup] ADD FOREIGN KEY (GroupIdFk) REFERENCES ...
| 2 Replies | 1917 Views | Created by Rockstarter - Thursday, August 16, 2012 5:25 PM | Last reply by Rockstarter - Thursday, August 16, 2012 5:32 PM

### Can Primary Keys that are "composite" be used as foreign keys in other tables?

There is no problem setting up a foreign key using a composite primary key; however, this require creating all these fields in the foreign table; clearly ...
| 3 Replies | 6947 Views | Created by BradleyA - Thursday, August 12, 2010 5:34 PM | Last reply by BradleyA - Thursday, August 12, 2010 7:39 PM

### SQL Server - Foreign Key Composition and Primary Key/Foreign Key Column Mappings

This code finds foreign key constraints and maps columns from primary to foreign key tables. My question is "what have I missed with respect to using the ...
| 1 Replies | 5837 Views | Created by Thomas B Winans - Friday, September 4, 2009 3:59 PM | Last reply by Aaron Alton - Saturday, September 5, 2009 3:35 PM

### Using composite key as foreign key

Composite (or compound?) keys are simple. Do you use (longitude, latitude) on a map? In full ANSI/ISO Standard SQL you can actually use a row constructor instead of separate ...
| 9 Replies | 1851 Views | Created by Kay92 - Saturday, November 9, 2013 8:20 PM | Last reply by --CELKO-- - Sunday, November 10, 2013 10:09 PM

### Composite Foreign Key 2 Columns / Primary Keys 3 Columns

systems (that's why Composite Key) )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON ...
| 1 Replies | 402 Views | Created by Faraz A. Qureshi - Tuesday, October 11, 2016 10:02 PM | Last reply by Tom Cooper - Tuesday, October 11, 2016 10:54 PM

### Composite Primary key and Foreign key

INT JOIN key or nvarchar(64) Natural Key? 11 as Foreign Key value or "Taylor Swift"?  How about a less exciting "SERIES H10 FINISHED ...
| 18 Replies | 59095 Views | Created by mahima - Friday, February 8, 2008 3:51 PM | Last reply by Kalman Toth - Sunday, April 10, 2011 8:52 PM

### composite primary key or composite foreign key problem while alteration of foreign key constraint

hi.. i made a procedure which retreives all foreign key information against a single primary key table. but this procedure have a ...
| 2 Replies | 4419 Views | Created by Mehmood Ahmed - Thursday, April 29, 2010 10:42 AM | Last reply by Gert-Jan Strik - Saturday, May 29, 2010 11:41 PM

### Psuedo-composite key, foreign key constraints

of this relationship, and records are destined to get orphaned.  I understand one can make a composite foreign key, but in my case I need to say “check ...
| 7 Replies | 7032 Views | Created by John Hennesey - Friday, April 15, 2011 3:30 PM | Last reply by John Hennesey - Thursday, April 21, 2011 1:38 PM

### Locating orphan composite foreign key records

I have 2 tables that SHOULD be related with a foreign key, but trying to create it raises an error because there are a number of orphan records. The primary ...
| 8 Replies | 5039 Views | Created by MasterReisender - Thursday, May 7, 2009 10:57 PM | Last reply by MasterReisender - Friday, May 8, 2009 4:17 PM

### Composite Primary Key vs Primary Key with Foreign Key?

I've been thinking about the use of a composite primary key in a table vs a table with a primary key and foreign key.  I'm having difficulty ...
| 6 Replies | 16854 Views | Created by new to sql server - Tuesday, December 28, 2010 3:01 AM | Last reply by irondoor827 - Saturday, May 28, 2011 8:35 PM