Back to blog

SQL SERVER

SQL SERVER Foreign Key Conflict Hatası

SQL SERVER Foreign Key Conflict Hatası, Msg, 547,, Level, 16,, State, 0,, Line, 1, The, ALTER, TABLE, statement, conflicted, with, the, FOREIGN, KEY, constraint,

Mustafa Yılmaz1 min read
SQL SERVER Foreign Key Conflict Hatası

Merhaba Arkadaşlar,

Aşağıdaki sql sorgusu ürün ve ürün foto tablosunu ilişkilendirmektedir.
alter table dbo.UrunFoto add constraint UrunFoto_UrunID_FK FOREIGN KEY ( UrunID )references dbo.Urun( UrunID)

Bu sorguyu çalıştırduğınızda şöyle bir hata alabilirsiniz.

Msg 547, Level 16, State 0, Line 1 The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "UrunFoto_Urun_FK". The conflict occurred in database "Delta", table "dbo.Urun", column 'UrunID'

Bu almanızın sebebi ilişki kurulmak istenen tablolarda kayıtların bulunması ile ilgilidir. Her iki tabloda ki kayıtları boşaltırsanız hata giderilecektir..

Related Articles