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

Problem creating FK referring to same table

Status
Not open for further replies.

gamcall

Programmer
Aug 23, 2000
24
0
0
GB
Hi,
When I try & do this (in SQLServer v7 sp3):

alter table tblCountry
add constraint FK_tblCountry_tblCountry
FOREIGN KEY (ship_to_country)
references tblCountry (countryky)

I get the following error:

Server: Msg 547, Level 16, State 1, Line 1

ALTER TABLE statement conflicted with COLUMN FOREIGN KEY SAME TABLE constraint 'FK_tblCountry_tblCountry'. The conflict occurred in database 'eng_dev_new', table 'tblCountry', column 'countryKy'.

What on _earth_ is going on? Any self-respecting database server should be able to handle such a foreign key. Indeed, the documentation explicitly talks about FKs referencing the same table. Is this a v7 bug?

T.I.A,
GAM

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top