我的查詢創建SQL Server 2012中的一些表如下:關於刪除級聯錯誤 - 如何用觸發器解決它?
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
)
,誤差
在介紹 表 'Poll_Vote_Table' FOREIGN KEY約束 'FK__Poll_Vote__PollA__5A3A55A2' 可能會導致循環或多個級聯路徑。 指定ON DELETE NO ACTION或ON UPDATE NO ACTION,或修改其他的FOREIGN KEY約束。 我該如何解決這個問題
標記您正在使用的dbms。另外添加其他兩個表定義。 – jarlh
爲什麼在刪除下表中的記錄之後要從主表中刪除? – Whencesoever