EnVisageOnline/Beta/Database/Schema/Views/dbo.VW_Expenditure2Calculat...

35 lines
2.5 KiB
Transact-SQL
Raw 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_Expenditure2Calculation]') AND type in (N'V'))
DROP VIEW [dbo].[VW_Expenditure2Calculation]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW [dbo].[VW_Expenditure2Calculation]
AS
SELECT Expenditure2Expenditure.Id,
Expenditure_Category.Id AS ExpenditureCategoryID,
Expenditure_Category.GLId,
Expenditure_Category.UOMId,
Expenditure_Category.Type,
Expenditure_Category.UseType,
Expenditure_Category.CGEFX,
Expenditure_Category.SortOrder,
Expenditure_Category.SystemAttributeOne,
Expenditure_Category.SystemAttributeTwo,
Expenditure.Name As ExpenditureName,
Expenditure2Expenditure.FactorType,
Expenditure2Expenditure.FactorInt,
Expenditure2Expenditure.ProcessOrder,
Expenditure2Expenditure.ParentId,
Expenditure_Category.CreditId,
Expenditure_Category.WksSubjectToFee
FROM Expenditure2Expenditure
LEFT OUTER JOIN Expenditure
INNER JOIN Expenditure_Category ON Expenditure.Id = Expenditure_Category.ExpenditureId
ON Expenditure2Expenditure.ChildId = Expenditure_Category.Id
GO