Ich habe folgendes:Löschen von Daten mit SQL-Constraints
DELETE FROM ContactBase
DELETE FROM AccountBase
Es Fehler mit:
The DELETE statement conflicted with the REFERENCE constraint "account_primary_contact". The conflict occurred in database "BMBLANK_MSCRM", table "dbo.AccountBase", column 'PrimaryContactId'.
The DELETE statement conflicted with the REFERENCE constraint "account_contacts". The conflict occurred in database "BMBLANK_MSCRM", table "dbo.ContactBase", column 'AccountId'.
Ich verstehe, weil der Zwang ich die Daten in einer bestimmten Reihenfolge löschen müssen, aber wenn ich umkehren:
DELETE FROM AccountBase
DELETE FROM ContactBase
es kehrt nur die Fehlermeldungen:
The DELETE statement conflicted with the REFERENCE constraint "account_contacts". The conflict occurred in database "BMBLANK_MSCRM", table "dbo.ContactBase", column 'AccountId'.
The DELETE statement conflicted with the REFERENCE constraint "account_primary_contact". The conflict occurred in database "BMBLANK_MSCRM", table "dbo.AccountBase", column 'PrimaryContactId'.
Wie lege ich diese Tabellen leer?
Dank
Ich frage mich, was ist die Beziehung zwischen diesen 2 Tabellen? klingt wie du hast eine viel zu viele Beziehung? wenn ja, würde ich das korrigieren, statt die Einschränkungen zu umgehen – GuidoG
1) eine der referenzierenden Spalten auf null aktualisieren 2) löschen –