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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can you solve this problem?

Status
Not open for further replies.

samosa

Technical User
Jul 15, 2005
38
0
0
IT
I have two tables, one called personnel and another called driver.
to determine which employee is driving which car, then each driver will be tracked by employee number(posNo).
As result, posNumber is a primary key in Personnel table and a foreign key in Driver table.
Each time I attemp to draw a relationship line between the two tables, I get the following error:
- Unable to create relationship 'FK_DRIVER_PERSONNELL'.
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER TABLE statement conflicted with COLUMN FOREIGN KEY constraint 'FK_DRIVER_PERSONNELL'. The conflict occurred in database 'Personnel', table 'PERSONNELL', column 'PosNumber'.

I am using sql server database.
Help is needed, please.
thanks in advance
 
It is probably because there are some invalid values in the Driver table. Run a query to check and clean up.

Select posNumber from Driver
where posNumber NOT IN (select posNumber from Personnel)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top