c# - Delete cascade on two 1:M foreign keys from same parent -


here 2 tables in visual studio 2015 project
table 1:

create table [dbo].[player] (     [id]         int           identity (1, 1) not null,     [first_name] nvarchar (50) null,     [last_name]  nvarchar (50) null,     [nickname]   nvarchar (50) not null,     primary key clustered ([id] asc) ); 

and table 2:

create table [dbo].[match] (     [id]            int      identity (1, 1) not null,     [time]          time (7) null,     [winner_id]     int      not null,     [loser_id]      int      not null,     [tournament_id] int      not null,     primary key clustered ([id] asc),     constraint [fk_player_winner] foreign key ([winner_id]) references [dbo].[player] ([id]),     constraint [fk_player_loser] foreign key ([loser_id]) references [dbo].[player] ([id]),     constraint [fk_match_tournament] foreign key ([tournament_id]) references [dbo].[tournament] ([id]) ); 

what want add on delete cascade on foreign keys in match table, unable create delete cascade on player foreign keys. able this, because if player deleted, matches had participated in deleted well, both winner , loser. backup solution add column in match holds "forfeit" value, matches flag not counted. flag set when player deleted. idea how implement this?


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -