EnVisageOnline/Main/Database/Scripts/20160321/02_VW_TeamResource_Recreate...

35 lines
653 B
Transact-SQL

USE [EnVisage]
GO
if exists (select 1 from sys.views where name = 'VW_TeamResource')
BEGIN
DROP VIEW [dbo].[VW_TeamResource]
END
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[VW_TeamResource] AS
SELECT PR.[Id]
,PR.[FirstName]
,PR.[LastName]
,PR.[IsActiveEmployee]
,PR.[ExpenditureCategoryId]
,PR.[StartDate]
,PR.[EndDate]
,PR.[EmployeeID]
,PR.[Email]
,PR.[WorkWeekId]
,PR2T.TeamId
,PR2T.StartDate as TeamStartDate
,PR2T.EndDate as TeamEndDate
,PR2T.Allocation
FROM PeopleResource PR
INNER JOIN PeopleResource2Team PR2T ON PR2T.PeopleResourceId = PR.Id
GO