USE [EnVisage]
GO

/****** Object:  StoredProcedure [dbo].[sp_DeleteScenario]    Script Date: 14.11.2014 17:12:01 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


ALTER PROCEDURE [dbo].[sp_DeleteScenario] (@aScenarioOID uniqueidentifier) AS
	BEGIN
	
		BEGIN TRANSACTION

		delete from History where EntityId = @aScenarioOID
		delete from Note where ParentId = @aScenarioOID
		delete from Rate where ParentId = @aScenarioOID
		delete from ScenarioDetail where ScenarioDetail.ParentID = @aScenarioOID
		delete from Scenario where id = @aScenarioOID

		COMMIT TRANSACTION 

 	END


GO


