Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TournamentsDB/TournamentsDB.sqlproj
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<Build Include="dbo\Stored Procedures\spMatchupEntries_Update.sql" />
<Build Include="dbo\Stored Procedures\spMatchupEntries_Insert.sql" />
<Build Include="dbo\Stored Procedures\spMatchupEntries_GetByMatchup.sql" />
<Build Include="dbo\Stored Procedures\spTournaments_Delete.sql" />
</ItemGroup>
<ItemGroup>
<None Include="PublishProfiles\TournamentsDBToPc.publish.xml" />
Expand Down
40 changes: 40 additions & 0 deletions TournamentsDB/dbo/Stored Procedures/spTournaments_Delete.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
CREATE PROCEDURE [dbo].[spTournaments_Delete]
@TournamentId int
AS
BEGIN

SET NOCOUNT ON;

DELETE FROM Prizes
WHERE id IN (
SELECT PrizeId
FROM TournamentPrizes
WHERE TournamentId = @TournamentId
);

DELETE FROM TournamentPrizes
WHERE TournamentId = @TournamentId;

------------------------------------------

DELETE FROM TournamentEntries
WHERE TournamentId = @TournamentId;

------------------------------------------

DELETE FROM MatchupEntries
WHERE MatchupId IN(
SELECT id
FROM Matchups
WHERE TournamentId = @TournamentId);


DELETE FROM Matchups
WHERE TournamentId = @TournamentId;

------------------------------------------

DELETE FROM Tournaments
WHERE id = @TournamentId;

END
Loading