私のクエリは次のとおりです。削除カスケードエラーの場合 - どのようにトリガで解決できますか?
create table Poll_Question_Table (
PollQuestionId int primary key,
PollQuestionTex varchar(max),
PollStatus int ,
PollStartDate date,
PollEndDate date,
PollCatagoryId int foreign key references Poll_Catagory_Table on update cascade on delete cascade
)
create table Poll_Catagory_Table(
PollCatagoryId int primary key,
PollCatagoryName varchar(100),
PollCatagoryDescription varchar(max)
)
create table Poll_Answer_Table(
PollAnswerId int primary key,
PollAnswerText varchar(max),
PollQuestionId int foreign key references Poll_Question_Table on update cascade on delete cascade
)
create table Poll_Vote_Table (
PollVoteId int primary key,
PollQuestionId int foreign key references Poll_Question_Table on update cascade on delete cascade ,
PollAnswerId int foreign key references Poll_Answer_Table on update cascade on delete cascade,
PollCount int
)
とエラーが テーブルの上にFOREIGN KEY制約「FK__Poll_Vote__PollA__5A3A55A2」を紹介
は「Poll_Vote_Table」サイクルが発生したりします複数のカスケード経路。 ON DELETE NO ACTIONまたはON UPNATE NO ACTIONを指定するか、他の FOREIGN KEY制約を変更してください。 どうすればこの問題を解決できますか?
使用しているdbmsにタグを付けます。他の2つのテーブル定義も追加します。 – jarlh
なぜあなたは下のテーブルでレコードを削除した後にメインテーブルから削除したいのですか? – Whencesoever