USE [envisage]
GO
/****** Object:  View [dbo].[VW_Scenario2Project]    Script Date: 06/23/2014 00:37:18 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[VW_Scenario2Project]'))
DROP VIEW [dbo].[VW_Scenario2Project]

/****** Object:  View [dbo].[VW_Scenario2Project]    Script Date: 06/23/2014 00:37:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE VIEW [dbo].[VW_Scenario2Project]
AS
	SELECT SC.Id,
	       SC.ParentId,
	       SC.TemplateId, 
	       SC.Type,
	       SC.Name, 
	       SC.ProjectedRevenue,
	       SC.ExpectedGrossMargin,
	       SC.CalculatedGrossMargin, 
	       SC.CGSplit,
	       SC.EFXSplit, 
	       SC.StartDate,
	       SC.EndDate, 
	       SC.Duration,
	       SC.Priority, 
	       SC.LowProbability,
	       SC.ExpectedProbability,
	       SC.HighProbability, 
	       SC.UseProbability,
	       SC.TDDirectCosts, 
	       SC.BUDirectCosts,
	       SC.Shots, 
	       SC.TDRevenueShot,
	       SC.BURevenueShot, 
	       SC.FreezeRevenue,
	       SC.LastUpdate,
	       SH.Id AS ShowObjectID,
	       SH.Name AS ShowName, 
	       SH.CompanyId,
	       SH.ClientId, 
	       SH.TypeId,
	       SH.StatusId,
	       SC.Color,
	       SC.Status,
	       SC.UseLMMargin,
	       SC.ExpectedGrossMargin_LM,
	       SC.CalculatedGrossMargin_LM,
	       SC.TDDirectCosts_LM,
	       SC.BUDirectCosts_LM,
	       SC.BURevenueShot_LM,
	       SC.ShotStartDate,
	       SC.CreatorObjectID,
	       SC.ModifiedByObjectID,
	       SC.EntryTimeStamp,
	       SC.GrowthScenario,
	       SC.Actuals_BUDirectCosts,
	       SC.Actuals_BUDirectCosts_LM,
	       SC.SystemAttributeObjectID
	  FROM Project SH RIGHT OUTER JOIN Scenario SC ON SH.Id = SC.ParentId
