How can I create reference key of non-unique column in SQL server 2008

5 pts.
Tags:
SQL Column Headings
SQL Server
SQL Server 2008
SQL Server administration
how i create refrence key of non-unique column in sql server 2008?

Answer Wiki

Thanks. We'll let you know when a new response is added.

You can’t.

Foreign keys must reference unique columns (or sets of columns). This includes primary keys or columns with a unique constraint.

[kccrosser] However, you CAN create a foreign key on two or more columns, as long as the combination of columns yields a unique value for each row.

For example, if I had a table of vehicle makes and models, I couldn’t create a foreign key just on the vehicle Make column, since there could be many Models for a given Make. I could create a foreign key on Make+Model, as that combination is unique.

The simple requirement is that a foreign key must resolve to a single row in the table (otherwise it isn’t a key).

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following