troubleshooting Question

create foreign key using query

Avatar of TrueBlue
TrueBlueFlag for United States of America asked on
Microsoft SQL ServerMicrosoft SQL Server 2008
28 Comments2 Solutions601 ViewsLast Modified:
Hi!

We have a MSSQL database running on a SQL server 2008.
We can access this database using SSMS.
We need to create a foreign key between two tables.
WebAccess and WebCustomers
Both of these tables have data in them.
WebAccess has a one to many relationship to WebCustomers
The key for WebAccess is Key_CorporateID
The Key for WebCustomers is CorporateIDKey
The column in common is CorporateID

Can someone please create a query that I can execute on SSMS to create the foreign key between these two tables?

TIA
ASKER CERTIFIED SOLUTION
Ioannis Paraskevopoulos

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 28 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 28 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros