EnVisageOnline/Main/Database/Schema/Views/dbo.VW_ScenarioAndProxyDeta...

33 lines
2.5 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.

/*
Run this script on SQL Server 2008 or later. There may be flaws if running on earlier versions of SQL Server.
*/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[VW_ScenarioAndProxyDetails]') AND type in (N'V'))
DROP VIEW [dbo].[VW_ScenarioAndProxyDetails]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE VIEW [dbo].[VW_ScenarioAndProxyDetails]
AS
SELECT Scenario_Detail.Id,
Scenario_Detail.ParentID,
Scenario_Detail.ExpenditureCategoryId,
Scenario_Detail.WeekEndingDate,
Scenario_Detail.Quantity, Scenario_Detail.LastUpdate,
Scenario_Detail.WeekOrdinal, Scenario_Detail.Cost,
Expenditure.Name AS ExpenditureCategoryName,
Expenditure_Category.GLId,
Expenditure_Category.UOMId,
Expenditure_Category.CreditId,
Expenditure_Category.Type,
Expenditure_Category.UseType,
Expenditure_Category.CGEFX,
Expenditure_Category.SystemAttributeOne,
Expenditure_Category.SystemAttributeTwo,
Expenditure_Category.SortOrder
FROM Scenario_Detail
INNER JOIN Expenditure_Category ON Expenditure_Category.Id = Scenario_Detail.ExpenditureCategoryId
INNER JOIN Expenditure ON Expenditure_Category.ExpenditureId = Expenditure.Id
GO