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.
Author |
Topic |
nomadsoul
Yak Posting Veteran
89 Posts |
Posted - 2006-12-05 : 19:33:58
|
I apologize for this primitive question butI've been allover BOL and google and I can't quite get the answer to my question which is: How do I make a foreign key constraint that references a column in another table?I get plenty of answer on how to do it with the same table. It is better to be prepared and not have an opportunity than to not be prepared and have an opportunity |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2006-12-05 : 21:12:46
|
here's an example from adventureworks:ALTER TABLE [HumanResources].[Employee] WITH CHECK ADD CONSTRAINT [FK_Employee_Contact_ContactID] FOREIGN KEY([ContactID])REFERENCES [Person].[Contact] ([ContactID])from here: http://www.elsasoft.org/tabular/SUMMER.AdventureWorks/table_HumanResourcesEmployee.htm SqlSpec: a fast and comprehensive data dictionary generator for SQL Server 2000/2005, Analysis Server 2005, Access 97/2000/XP/2003 http://www.elsasoft.org |
 |
|
|
|
|