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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-06-08 : 08:46:51
|
Chris writes "I have a database that have been preforming adequertly for some time, two tables are linked by primary.foreign keys
for no reason updating the parent key is causing a foreign key constriant to fail
i have modelled the problem as below
CREATE TABLE T1 (F1 CHAR(1)) ALTER TABLE T1 ADD CONSTRAINT PK1 PRIMARY KEY (F1) INSERT INTO T1 VALUES ('A')
CREATE TABLE T2 (F2 CHAR(1)) ALTER TABLE T2 ADD CONSTRAINT PK2 PRIMARY KEY (F2) ALTER TABLE T2 ADD CONSTRAINT FK1 (F2) REFERENCES T1(F1) INSERT INTO T2 VALUES ('A')
UPDATE T1 SET F1 = F1 WHERE F1 = 'A'
Fails with contraint violation FK1
Any help would be most appreciated
ta
Chris" |
|
|
|
|
|