Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Primary Keys

Author  Topic 

paul.rowling
Yak Posting Veteran

81 Posts

Posted - 2003-05-01 : 05:52:58
Hi,

I have two tables in question, a "letter_history" table and a "customers" table. I want to create a primary key in the letter_history table which is made up of the customer_id field and a mailing_id field. I have done this and the primary key symbol is displayed next to each of the two fields. I now want to be able to create a relationship between the letter_history table and the customers table via the customer_id field which exists in both tables. When I try to do this i receive the following message:

The columns in letter_history do not match an existing primary key or unique constraint.

I think this may be something to do with the letter_history primary key being a composite/compound key, but I'm not sure.

Any help would be greatly appreciated.

Cheers

Paul

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2003-05-01 : 06:03:59
You shouldn't have a problem, as I understand it.

Check that customer_id is the primary key of customer's!

Ciao

*#&#* *#&#* *#&#* *#&#*

Chaos, Disorder and Panic ... my work is done here!

Edited by - wanderer on 05/01/2003 06:04:45
Go to Top of Page

paul.rowling
Yak Posting Veteran

81 Posts

Posted - 2003-05-01 : 06:32:22
Hi,

Customer_Id is definately the primary key of the customers table.

Cheers

Paul

Go to Top of Page

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-05-01 : 07:34:03
Can you give us the "ALTER TABLE letter_history" DDL you are using to create the foreign key constraint?

Jay White
{0}
Go to Top of Page

paul.rowling
Yak Posting Veteran

81 Posts

Posted - 2003-05-02 : 02:49:17
Sorry to be asking stupid questions, but I'm new to sql server. How do I get the information your asking for??

Cheers

Paul

Go to Top of Page

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2003-05-02 : 03:10:54
I suspect he's using EM to try and do the changes...



*#&#* *#&#* *#&#* *#&#*

Chaos, Disorder and Panic ... my work is done here!
Go to Top of Page
   

- Advertisement -