Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error While Creating Relationship 1

Status
Not open for further replies.

Mike555

Technical User
Feb 21, 2003
1,200
US
I have 2 tables: ORDERS & CUSTOMERS

The CUSTOMERS table has a UNIQUE constraint on the "CustomerName" column. I created this constraint so that I can relate this table to others without involving the primary key on the CUSTOMER table.

I've attempted to create a relationship between the column CUSTOMERS.CustomerName & ORDERS.CustomerName, but I receive the following error message:

Code:
'Customer' table saved successfully
'Orders' table
- Unable to create relationship 'FK_Orders_Customer'.  
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint 'FK_Orders_Customer'. The conflict occurred in database 'xxxx', table 'Customer', column 'CustomerName'.

Can someone point me in the right direction and help me understand why this is erroring-out? Thanks.

--
Mike
 
Check the Orders table. It looks like you might have records in that table that are not in the Customers table.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top