EnVisageOnline/Beta/Database/Scripts/20141121/02_modift_DeleteProject_sto...

29 lines
1.7 KiB
Transact-SQL
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

USE [EnVisage]
GO
/****** Object: StoredProcedure [dbo].[sp_DeleteProject] Script Date: 11/21/2014 11:46:13 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_DeleteProject] (@id uniqueidentifier) AS
BEGIN
BEGIN TRANSACTION
select Id into #scenarioId2Delete from Scenario where Scenario.ParentId = @id
delete from History where EntityId in (select id from #scenarioId2Delete)
delete from Note where ParentId in (select id from #scenarioId2Delete)
delete from Rate where ParentId in (select id from #scenarioId2Delete)
delete from ScenarioDetail where ScenarioDetail.ParentID in (select id from #scenarioId2Delete)
delete from Scenario where id in (select id from #scenarioId2Delete)
delete from Team2Project where ProjectId = @id
delete from Project where id = @id
COMMIT TRANSACTION
END